@@ -15,6 +15,7 @@ import type { AlignType } from '@rc-component/trigger/lib/interface';
1515import classNames from 'classnames' ;
1616import useMergedState from 'rc-util/lib/hooks/useMergedState' ;
1717import warning from 'rc-util/lib/warning' ;
18+ import pickAttrs from 'rc-util/lib/pickAttrs' ;
1819import * as React from 'react' ;
1920import useHoverValue from './hooks/useHoverValue' ;
2021import usePickerInput from './hooks/usePickerInput' ;
@@ -33,7 +34,7 @@ import PickerPanel from './PickerPanel';
3334import PickerTrigger from './PickerTrigger' ;
3435import PresetPanel from './PresetPanel' ;
3536import { formatValue , isEqual , parseValue } from './utils/dateUtil' ;
36- import getDataOrAriaProps , { toArray } from './utils/miscUtil' ;
37+ import { toArray } from './utils/miscUtil' ;
3738import { elementsContains , getDefaultFormat , getInputSize } from './utils/uiUtil' ;
3839import { legacyPropsWarning } from './utils/warnUtil' ;
3940
@@ -143,6 +144,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
143144 const {
144145 prefixCls = 'rc-picker' ,
145146 id,
147+ name,
146148 tabIndex,
147149 style,
148150 className,
@@ -386,14 +388,10 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
386388 if ( pickerRef ) {
387389 pickerRef . current = {
388390 focus : ( ) => {
389- if ( inputRef . current ) {
390- inputRef . current . focus ( ) ;
391- }
391+ inputRef . current ?. focus ( ) ;
392392 } ,
393393 blur : ( ) => {
394- if ( inputRef . current ) {
395- inputRef . current . blur ( ) ;
396- }
394+ inputRef . current ?. blur ( ) ;
397395 } ,
398396 } ;
399397 }
@@ -501,7 +499,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
501499 ) ;
502500 }
503501
504- const mergedInputProps : React . InputHTMLAttributes < HTMLInputElement > = {
502+ const mergedInputProps : React . InputHTMLAttributes < HTMLInputElement > & { ref : React . MutableRefObject < HTMLInputElement > } = {
505503 id,
506504 tabIndex,
507505 disabled,
@@ -516,7 +514,8 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
516514 title : text ,
517515 ...inputProps ,
518516 size : getInputSize ( picker , formatList [ 0 ] , generateConfig ) ,
519- ...getDataOrAriaProps ( props ) ,
517+ name,
518+ ...pickAttrs ( props , { aria : true , data : true } ) ,
520519 autoComplete,
521520 } ;
522521
0 commit comments