Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Move focus onto menu after blurring
if (
document.activeElement === document.body &&
menuRef.current &&
!isTouchDevice()
) {
menuRef.current.focus();
}
},
[menuRef]
);
return {
role: "menuitem",
onMouseOver: useAllCallbacks(onMouseOver, htmlOnMouseOver),
onMouseOut: useAllCallbacks(onMouseOut, htmlOnMouseOut),
...htmlProps
};
}
});
{
ref: htmlRef,
onFocus: htmlOnFocus,
onBlur: htmlOnBlur,
onMouseEnter: htmlOnMouseEnter,
onMouseLeave: htmlOnMouseLeave,
...htmlProps
}
) {
return {
ref: mergeRefs(options.unstable_referenceRef, htmlRef),
tabIndex: 0,
onFocus: useAllCallbacks(options.show, htmlOnFocus),
onBlur: useAllCallbacks(options.hide, htmlOnBlur),
onMouseEnter: useAllCallbacks(options.show, htmlOnMouseEnter),
onMouseLeave: useAllCallbacks(options.hide, htmlOnMouseLeave),
"aria-describedby": options.baseId,
...htmlProps
};
}
});
useProps(
options,
{
ref: htmlRef,
onFocus: htmlOnFocus,
onBlur: htmlOnBlur,
onMouseEnter: htmlOnMouseEnter,
onMouseLeave: htmlOnMouseLeave,
...htmlProps
}
) {
return {
ref: mergeRefs(options.unstable_referenceRef, htmlRef),
tabIndex: 0,
onFocus: useAllCallbacks(options.show, htmlOnFocus),
onBlur: useAllCallbacks(options.hide, htmlOnBlur),
onMouseEnter: useAllCallbacks(options.show, htmlOnMouseEnter),
onMouseLeave: useAllCallbacks(options.hide, htmlOnMouseLeave),
"aria-describedby": options.baseId,
...htmlProps
};
}
});
useProps(options, { onClick: htmlOnClick, ...htmlProps }) {
const onClick = React.useCallback(() => {
window.requestAnimationFrame(() => {
const input = getFirstInvalidInput(options.baseId);
if (input) {
input.focus();
if ("select" in input) {
input.select();
}
}
});
}, [options.baseId]);
return {
type: "submit",
onClick: useAllCallbacks(onClick, htmlOnClick),
...htmlProps
};
}
});
options.update(options.name, options.value);
}, [options.update, options.name, options.value]);
const onBlur = React.useCallback(() => {
options.blur(options.name);
}, [options.blur, options.name]);
const onFocus = React.useCallback(() => {
options.update(options.name, options.value);
}, [options.update, options.name, options.value]);
return {
name: formatInputName(options.name),
onChange: useAllCallbacks(onChange, htmlOnChange),
onBlur: useAllCallbacks(onBlur, htmlOnBlur),
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
...htmlProps
};
}
}) as >(
const onChange = React.useCallback(() => {
options.update(options.name, options.value);
}, [options.update, options.name, options.value]);
const onBlur = React.useCallback(() => {
options.blur(options.name);
}, [options.blur, options.name]);
const onFocus = React.useCallback(() => {
options.update(options.name, options.value);
}, [options.update, options.name, options.value]);
return {
name: formatInputName(options.name),
onChange: useAllCallbacks(onChange, htmlOnChange),
onBlur: useAllCallbacks(onBlur, htmlOnBlur),
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
...htmlProps
};
}
}) as >(
const input = document.querySelector(selector);
if (input) {
input.focus();
}
});
}, [
options.push,
options.name,
options.value,
options.values,
options.baseId
]);
return {
id: getPushButtonId(options.name, options.baseId),
onClick: useAllCallbacks(onClick, htmlOnClick),
...htmlProps
};
}
}) as >(
"See https://reakit.io/docs/dialog"
);
return;
}
event.stopPropagation();
options.hide();
}
},
[options.hideOnEsc, options.hide]
);
return {
ref: mergeRefs(dialog, htmlRef),
role: "dialog",
tabIndex: -1,
onKeyDown: useAllCallbacks(onKeyDown, htmlOnKeyDown),
unstable_wrap: usePipe(wrap, portalWrap, htmlWrap),
"aria-modal": options.modal ? true : undefined,
"data-dialog": true,
...htmlProps
};
}
});
) {
const onChange = React.useCallback(() => {
options.update(options.name, options.value);
}, [options.update, options.name, options.value]);
const onBlur = React.useCallback(() => {
options.blur(options.name);
}, [options.blur, options.name]);
const onFocus = React.useCallback(() => {
options.update(options.name, options.value);
}, [options.update, options.name, options.value]);
return {
name: formatInputName(options.name),
onChange: useAllCallbacks(onChange, htmlOnChange),
onBlur: useAllCallbacks(onBlur, htmlOnBlur),
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
...htmlProps
};
}
}) as >(
options.show();
} else {
options.toggle();
}
}, [
hasParent,
parentIsMenuBar,
hasShownOnFocus,
options.show,
options.toggle
]);
return {
ref: mergeRefs(ref, htmlRef),
"aria-haspopup": "menu",
onClick: useAllCallbacks(onClick, htmlOnClick),
onKeyDown: useAllCallbacks(onKeyDown, htmlOnKeyDown),
onFocus: useAllCallbacks(onFocus, htmlOnFocus),
onMouseOver: useAllCallbacks(onMouseOver, htmlOnMouseOver),
...htmlProps
};
},