Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility improvement on #29530 issue #29534

Merged
merged 11 commits into from
Mar 10, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ function NavigationToggle( { icon, isOpen } ) {

const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );

document.addEventListener(
Addison-Stavlo marked this conversation as resolved.
Show resolved Hide resolved
'keydown',
function ( e ) {
if ( e.key === 'Escape' ) {
Addison-Stavlo marked this conversation as resolved.
Show resolved Hide resolved
setIsNavigationPanelOpened( false );
}
},
{ once: true }
);

if ( ! isActive ) {
return null;
}
Expand Down