Honor the share-link miss limit before querying, and keep Escape inside the access menu.

This commit is contained in:
adilallo committed 2026-11-21 11:56:34 -07:00
1 parent 75649a9a42
commit 1b3d055c81
8 files changed
+189 -19

No files matched your search

@@ -260,6 +260,9 @@ const SelectInputContainer = forwardRef<HTMLButtonElement, SelectInputProps>(
return;
}
if (e.key === "Escape") {
if (!isOpen) return;
e.preventDefault();
e.stopPropagation();
closeMenu();
}
},
@@ -287,14 +290,23 @@ const SelectInputContainer = forwardRef<HTMLButtonElement, SelectInputProps>(
}
}, [disabled, shouldAutoManageFocus]);
// Handle blur
const handleBlur = useCallback(() => {
if (shouldAutoManageFocus) {
setIsFocused(false);
setFocusMethod(null);
wasMouseDownRef.current = false;
}
}, [shouldAutoManageFocus]);
const handleMenuMouseDown = useCallback((event: React.MouseEvent) => {
event.preventDefault();
}, []);
const handleBlur = useCallback(
(event: React.FocusEvent<HTMLButtonElement>) => {
if (shouldAutoManageFocus) {
setIsFocused(false);
setFocusMethod(null);
wasMouseDownRef.current = false;
}
const next = event.relatedTarget;
if (next instanceof Node && menuRef.current?.contains(next)) return;
closeMenu();
},
[closeMenu, shouldAutoManageFocus],
);
// Determine actual state:
// - Active: when clicked (mouse focus) or when dropdown is open
@@ -362,6 +374,7 @@ const SelectInputContainer = forwardRef<HTMLButtonElement, SelectInputProps>(
onButtonMouseDown={handleMouseDown}
onButtonFocus={handleFocus}
onButtonBlur={handleBlur}
onMenuMouseDown={handleMenuMouseDown}
onOptionClick={handleOptionSelect}
selectRef={selectRef}
menuRef={menuRef}