Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make the navigabel region wrap the inert sidebar.
  • Loading branch information
afercia committed Jul 25, 2023
commit 4370f9b973f9ac6320861ec07504f772499d79cc
46 changes: 25 additions & 21 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,28 +260,32 @@ export default function Layout() {
</motion.div>

<div className="edit-site-layout__content">
<motion.div
// The sidebar is needed for routing on mobile
// (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
// so we can't remove the element entirely. Using `inert` will make
// it inaccessible to screen readers and keyboard navigation.
inert={ showSidebar ? undefined : 'inert' }
animate={ { opacity: showSidebar ? 1 : 0 } }
transition={ {
type: 'tween',
duration:
// Disable transition in mobile to emulate a full page transition.
disableMotion || isMobileViewport
? 0
: ANIMATION_DURATION,
ease: 'easeOut',
} }
className="edit-site-layout__sidebar"
>
<NavigableRegion ariaLabel={ __( 'Navigation' ) }>
{ /*
The NavigableRegion must always be rendered and not use
`inert` otherwise `useNavigateRegions` will fail.
*/ }
<NavigableRegion ariaLabel={ __( 'Navigation' ) }>
<motion.div
// The sidebar is needed for routing on mobile
// (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
// so we can't remove the element entirely. Using `inert` will make
// it inaccessible to screen readers and keyboard navigation.
inert={ showSidebar ? undefined : 'inert' }
animate={ { opacity: showSidebar ? 1 : 0 } }
transition={ {
type: 'tween',
duration:
// Disable transition in mobile to emulate a full page transition.
disableMotion || isMobileViewport
? 0
: ANIMATION_DURATION,
ease: 'easeOut',
} }
className="edit-site-layout__sidebar"
>
<Sidebar />
</NavigableRegion>
</motion.div>
</motion.div>
</NavigableRegion>

<SavePanel />

Expand Down