Fixed hotkey bug with Select component and added debug logs for hotkeys (#4879)
- Select component was adding a duplicate useListenClickOutside already present in useDropdown for closing dropdown. - Added debug logs for hotkeys scopes
This commit is contained in:
@ -10,7 +10,6 @@ import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/Dropdow
|
||||
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
||||
import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener';
|
||||
|
||||
import { SelectHotkeyScope } from '../types/SelectHotkeyScope';
|
||||
|
||||
@ -113,15 +112,6 @@ export const Select = <Value extends string | number | null>({
|
||||
|
||||
const { closeDropdown } = useDropdown(dropdownId);
|
||||
|
||||
const { useListenClickOutside } = useClickOutsideListener(dropdownId);
|
||||
|
||||
useListenClickOutside({
|
||||
refs: [selectContainerRef],
|
||||
callback: () => {
|
||||
closeDropdown();
|
||||
},
|
||||
});
|
||||
|
||||
const selectControl = (
|
||||
<StyledControlContainer disabled={isDisabled}>
|
||||
<StyledControlLabel>
|
||||
|
||||
@ -145,6 +145,7 @@ const TextInputComponent = (
|
||||
|
||||
const handleFocus: FocusEventHandler<HTMLInputElement> = (e) => {
|
||||
onFocus?.(e);
|
||||
|
||||
if (!disableHotkeys) {
|
||||
setHotkeyScopeAndMemorizePreviousScope(InputHotkeyScope.TextInput);
|
||||
}
|
||||
@ -152,6 +153,7 @@ const TextInputComponent = (
|
||||
|
||||
const handleBlur: FocusEventHandler<HTMLInputElement> = (e) => {
|
||||
onBlur?.(e);
|
||||
|
||||
if (!disableHotkeys) {
|
||||
goBackToPreviousHotkeyScope();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user