Skip to content

Commit

Permalink
chore: add role to clear button (#250)
Browse files Browse the repository at this point in the history
* chore: add role to clear button

* chore: update snapshot
  • Loading branch information
kerm1it authored May 13, 2021
1 parent 8bc4cce commit f1ab1e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ type OmitPanelProps<Props> = Omit<
'onChange' | 'hideHeader' | 'pickerValue' | 'onPickerValueChange'
>;

export type PickerBaseProps<DateType> = {} & PickerSharedProps<DateType> & OmitPanelProps<PickerPanelBaseProps<DateType>>;
export type PickerBaseProps<DateType> = {} & PickerSharedProps<DateType> &
OmitPanelProps<PickerPanelBaseProps<DateType>>;

export type PickerDateProps<DateType> = {} & PickerSharedProps<DateType> & OmitPanelProps<PickerPanelDateProps<DateType>>;
export type PickerDateProps<DateType> = {} & PickerSharedProps<DateType> &
OmitPanelProps<PickerPanelDateProps<DateType>>;

export type PickerTimeProps<DateType> = {
picker: 'time';
Expand All @@ -109,7 +111,8 @@ export type PickerTimeProps<DateType> = {
* since `defaultOpenValue` will confuse user of current value status
*/
defaultOpenValue?: DateType;
} & PickerSharedProps<DateType> & Omit<OmitPanelProps<PickerPanelTimeProps<DateType>>, 'format'>;
} & PickerSharedProps<DateType> &
Omit<OmitPanelProps<PickerPanelTimeProps<DateType>>, 'format'>;

export type PickerProps<DateType> =
| PickerBaseProps<DateType>
Expand Down Expand Up @@ -194,9 +197,8 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
const [selectedValue, setSelectedValue] = React.useState<DateType | null>(mergedValue);

// Operation ref
const operationRef: React.MutableRefObject<ContextOperationRefProps | null> = React.useRef<ContextOperationRefProps>(
null,
);
const operationRef: React.MutableRefObject<ContextOperationRefProps | null> =
React.useRef<ContextOperationRefProps>(null);

// Open
const [mergedOpen, triggerInnerOpen] = useMergedState(false, {
Expand Down Expand Up @@ -433,6 +435,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
triggerOpen(false);
}}
className={`${prefixCls}-clear`}
role="button"
>
{clearIcon || <span className={`${prefixCls}-clear-btn`} />}
</span>
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/picker.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`Picker.Basic icon 1`] = `
</span>
<span
class="rc-picker-clear"
role="button"
>
<span
class="suffix-icon"
Expand Down

1 comment on commit f1ab1e0

@vercel
Copy link

@vercel vercel bot commented on f1ab1e0 May 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.