Skip to content

Commit 12abe68

Browse files
committed
fix: don't focus on input when clear button clicked
this is how combobox works
1 parent 7eeabb2 commit 12abe68

3 files changed

Lines changed: 3 additions & 24 deletions

File tree

packages/shared/widget-plugin-dropdown-filter/src/controls/combobox/Combobox.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,7 @@ export const Combobox = observer(function Combobox(props: ComboboxProps) {
4949
placeholder: props.inputPlaceholder
5050
})}
5151
/>
52-
<ClearButton
53-
cls={cls}
54-
onClick={() => {
55-
props.onClear();
56-
inputRef.current?.focus();
57-
}}
58-
visible={!props.empty}
59-
/>
52+
<ClearButton cls={cls} onClick={props.onClear} visible={!props.empty} />
6053
<button className={cls.toggle} {...getToggleButtonProps({ "aria-label": "Show options" })}>
6154
<Arrow className={cls.stateIcon} />
6255
</button>

packages/shared/widget-plugin-dropdown-filter/src/controls/select/Select.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,7 @@ export const Select = observer(function Select(props: SelectProps): React.ReactE
5252
>
5353
<span className={cls.toggle}>{props.value}</span>
5454
<div className={`${cls.root}-controls`}>
55-
<ClearButton
56-
cls={cls}
57-
onClick={() => {
58-
props.onClear();
59-
toggleRef.current?.focus();
60-
}}
61-
visible={showClear}
62-
/>
55+
<ClearButton cls={cls} onClick={props.onClear} visible={showClear} />
6356
<Arrow className={cls.stateIcon} />
6457
</div>
6558
</button>

packages/shared/widget-plugin-dropdown-filter/src/controls/tag-picker/TagPicker.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,7 @@ export const TagPicker = observer(function TagPicker(props: TagPickerProps): Rea
103103
</div>
104104
)}
105105
</div>
106-
<ClearButton
107-
cls={cls}
108-
onClick={() => {
109-
props.onClear();
110-
inputRef.current?.focus();
111-
}}
112-
visible={!props.empty}
113-
/>
106+
<ClearButton cls={cls} onClick={props.onClear} visible={!props.empty} />
114107
<button className={cls.toggle} {...getToggleButtonProps({ "aria-label": "Show options" })}>
115108
<Arrow className={cls.stateIcon} />
116109
</button>

0 commit comments

Comments
 (0)