Skip to content

Commit d495072

Browse files
committed
chore: focus on tags when left arrow of backspace is clicked with cursor position 0
1 parent 862fa36 commit d495072

File tree

1 file changed

+7
-3
lines changed
  • packages/shared/widget-plugin-filtering/src/controls/tag-picker

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ export const TagPicker = observer(function TagPicker(props: TagPickerProps): Rea
6363
data-empty={props.empty ? true : undefined}
6464
style={props.style}
6565
onClick={event => {
66-
if (!isOpen && (event.target === event.currentTarget || event.target === inputContainerRef.current)) {
67-
openMenu();
66+
if (event.target === event.currentTarget || event.target === inputContainerRef.current) {
67+
if (!isOpen) {
68+
openMenu();
69+
} else {
70+
inputContainerRef.current?.querySelector("input")?.focus();
71+
}
6872
}
6973
}}
7074
>
@@ -98,7 +102,7 @@ export const TagPicker = observer(function TagPicker(props: TagPickerProps): Rea
98102
onBlur: props.onBlur,
99103
onFocus: props.onFocus,
100104
placeholder: props.empty ? props.inputPlaceholder : undefined,
101-
...getDropdownProps({ preventKeyAction: isOpen }),
105+
...getDropdownProps(),
102106
"aria-describedby": props.empty ? undefined : `${helperText1} ${inputContainerId}`
103107
})}
104108
/>

0 commit comments

Comments
 (0)