add randomizer module
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s

This commit is contained in:
Shinuwa 2026-08-31 09:10:38 +02:00
parent 07de342fc2
commit 35fe877d58
32 changed files with 3822 additions and 200 deletions

View file

@ -13,6 +13,7 @@ export function CompactDropdown({
}) {
const [open, setOpen] = useState(false);
const rootRef = useRef(null);
const internalPointerDownRef = useRef(false);
useEffect(() => {
if (!open) return undefined;
@ -48,7 +49,14 @@ export function CompactDropdown({
onMouseEnter={openOnHover ? () => setOpen(true) : undefined}
onMouseLeave={closeOnMouseLeave ? close : undefined}
onFocusCapture={openOnHover ? () => setOpen(true) : undefined}
onPointerDownCapture={() => {
internalPointerDownRef.current = true;
window.setTimeout(() => {
internalPointerDownRef.current = false;
}, 0);
}}
onBlurCapture={(event) => {
if (internalPointerDownRef.current) return;
if (!event.currentTarget.contains(event.relatedTarget)) close();
}}
onMouseDown={preventMouseDown ? (event) => event.preventDefault() : undefined}