prevent focus root element when route became focusable

This commit is contained in:
NikolaBorislavovHristov 2019-08-09 14:10:32 +03:00
parent 1c2b2c1911
commit d7ad6517a7

View file

@ -21,10 +21,6 @@ const FocusableProvider = ({ children, onRoutesContainerDomTreeChange, onModalsC
modalsContainer: modalsContainer,
contentContainer: contentContainerRef.current
});
if (focusable) {
contentContainerRef.current.focus();
}
setFocusable(focusable);
};
const routesContainerDomTreeObserver = new MutationObserver(onDomTreeChange);
@ -39,7 +35,7 @@ const FocusableProvider = ({ children, onRoutesContainerDomTreeChange, onModalsC
}, [routesContainer, modalsContainer, onRoutesContainerDomTreeChange, onModalsContainerDomTreeChange]);
return (
<FocusableContext.Provider value={focusable}>
{React.cloneElement(React.Children.only(children), { ref: contentContainerRef, tabIndex: -1 })}
{React.cloneElement(React.Children.only(children), { ref: contentContainerRef })}
</FocusableContext.Provider>
);
};