Skip to content

Commit

Permalink
refactor(autocomplete): apply chain and add type to e
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Aug 20, 2024
1 parent c02fa15 commit 8ceb3ef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/components/autocomplete/src/use-autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,19 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
className: slots.endContentWrapper({
class: clsx(classNames?.endContentWrapper, props?.className),
}),
onPointerDown: (e) => {
onPointerDown: chain(props.onPointerDown, (e: React.PointerEvent) => {
if (e.button === 0 && e.currentTarget === e.target) {
inputRef.current?.focus();
}
},
onMouseDown: (e) => {
}),
onMouseDown: chain(props.onMouseDown, (e: React.MouseEvent) => {
if (e.button === 0 && e.currentTarget === e.target) {
// Chrome and Firefox on touch Windows devices require mouse down events
// to be canceled in addition to pointer events, or an extra asynchronous
// focus event will be fired.
e.preventDefault();
}
},
}),
});

return {
Expand Down

0 comments on commit 8ceb3ef

Please sign in to comment.