mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 14:52:13 +00:00
prevent focus root element when route became focusable
This commit is contained in:
parent
1c2b2c1911
commit
d7ad6517a7
1 changed files with 1 additions and 5 deletions
|
|
@ -21,10 +21,6 @@ const FocusableProvider = ({ children, onRoutesContainerDomTreeChange, onModalsC
|
||||||
modalsContainer: modalsContainer,
|
modalsContainer: modalsContainer,
|
||||||
contentContainer: contentContainerRef.current
|
contentContainer: contentContainerRef.current
|
||||||
});
|
});
|
||||||
if (focusable) {
|
|
||||||
contentContainerRef.current.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
setFocusable(focusable);
|
setFocusable(focusable);
|
||||||
};
|
};
|
||||||
const routesContainerDomTreeObserver = new MutationObserver(onDomTreeChange);
|
const routesContainerDomTreeObserver = new MutationObserver(onDomTreeChange);
|
||||||
|
|
@ -39,7 +35,7 @@ const FocusableProvider = ({ children, onRoutesContainerDomTreeChange, onModalsC
|
||||||
}, [routesContainer, modalsContainer, onRoutesContainerDomTreeChange, onModalsContainerDomTreeChange]);
|
}, [routesContainer, modalsContainer, onRoutesContainerDomTreeChange, onModalsContainerDomTreeChange]);
|
||||||
return (
|
return (
|
||||||
<FocusableContext.Provider value={focusable}>
|
<FocusableContext.Provider value={focusable}>
|
||||||
{React.cloneElement(React.Children.only(children), { ref: contentContainerRef, tabIndex: -1 })}
|
{React.cloneElement(React.Children.only(children), { ref: contentContainerRef })}
|
||||||
</FocusableContext.Provider>
|
</FocusableContext.Provider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue