mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-29 05:38:48 +00:00
using nativeEvent to mark event as handled
This commit is contained in:
parent
45c0edbde9
commit
ca4e83148e
2 changed files with 4 additions and 4 deletions
|
|
@ -21,7 +21,7 @@ const Input = React.forwardRef(({ type, tabIndex, children, ...props }, ref) =>
|
|||
props.onKeyUp(event);
|
||||
}
|
||||
|
||||
if (!event.handled && event.keyCode === ENTER_KEY_CODE) {
|
||||
if (!event.nativeEvent.handled && event.keyCode === ENTER_KEY_CODE) {
|
||||
if (BUTTON_INPUT_TYPES.includes(type)) {
|
||||
event.currentTarget.click();
|
||||
} else if (TEXT_INPUT_TYPES.includes(type)) {
|
||||
|
|
@ -36,7 +36,7 @@ const Input = React.forwardRef(({ type, tabIndex, children, ...props }, ref) =>
|
|||
props.onMouseDown(event);
|
||||
}
|
||||
|
||||
if (!event.handled && BUTTON_INPUT_TYPES.includes(type)) {
|
||||
if (!event.nativeEvent.handled && BUTTON_INPUT_TYPES.includes(type)) {
|
||||
event.preventDefault();
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur();
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ const styles = require('./styles');
|
|||
|
||||
const ConsentCheckbox = React.forwardRef(({ className, checked, label, link, href, toggle }, ref) => {
|
||||
const checkboxOnClick = React.useCallback((event) => {
|
||||
if (!event.handled && typeof toggle === 'function') {
|
||||
if (!event.nativeEvent.handled && typeof toggle === 'function') {
|
||||
toggle(event);
|
||||
}
|
||||
}, [toggle]);
|
||||
const linkOnClick = React.useCallback((event) => {
|
||||
event.handled = true;
|
||||
event.nativeEvent.handled = true;
|
||||
}, []);
|
||||
return (
|
||||
<Checkbox ref={ref} className={classnames(className, styles['consent-checkbox-container'])} checked={checked} onClick={checkboxOnClick}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue