mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
MainNavBar tabs switch fixed in firefox
This commit is contained in:
parent
1e93ee2079
commit
a97dfb1e2f
1 changed files with 4 additions and 3 deletions
|
|
@ -13,17 +13,18 @@ const TABS = [
|
|||
const MainNavBar = ({ className }) => {
|
||||
const focusable = useFocusable();
|
||||
React.useEffect(() => {
|
||||
const onKeyUp = (event) => {
|
||||
const onKeyDown = (event) => {
|
||||
const tab = TABS.find(({ keyCode }) => event.keyCode === keyCode);
|
||||
if (tab) {
|
||||
event.preventDefault();
|
||||
window.location = tab.href;
|
||||
}
|
||||
};
|
||||
if (focusable) {
|
||||
window.addEventListener('keyup', onKeyUp);
|
||||
window.addEventListener('keydown', onKeyDown);
|
||||
}
|
||||
return () => {
|
||||
window.removeEventListener('keyup', onKeyUp);
|
||||
window.removeEventListener('keydown', onKeyDown);
|
||||
};
|
||||
}, [focusable]);
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue