gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Navigation Block Responsive modal is missing fade out animation

Open TobyOsborne opened this issue 3 years ago • 2 comments

What problem does this address?

In responsive view, the navigation block has a fade-in animation, but not a fade out.

What is your proposed solution?

Can we edit the MicroModal.init settings, and the SCSS to cater to this?

https://github.com/WordPress/gutenberg/blob/de0f414fbf3286131f735242813d871d5fd9ff0d/packages/block-library/src/navigation/view-modal.js#L41-L45

Becomes:

MicroModal.init({
	onShow: navigationToggleModal,
	onClose: navigationToggleModal,
	openClass: "is-menu-open",
	awaitOpenAnimation: true,
	awaitCloseAnimation: true,
	disableScroll: true,
});

And then in the SCSS instead of using the is-menu-open class, use the aria-hidden attribute to set the animations (and only the animations). Which would then allow for an opening and closing animation.

.wp-block-navigation__responsive-container[aria-hidden="false"] {
	animation: ...
}

.wp-block-navigation__responsive-container[aria-hidden="true"] {
	animation: ...
}

This will open up the possibility for theme developers to change/implement different types of responsive menus without having to dequeue the view-modal script. (In my case I'm editing it to be a slideout menu).

TobyOsborne avatar Jan 11 '23 15:01 TobyOsborne

I would like that, too. Is there for now a way to dequeue the view-scripts?

anon36 avatar Mar 29 '23 20:03 anon36

Created a PR for this: https://github.com/WordPress/gutenberg/pull/85820

00kaku avatar Oct 28 '26 07:10 00kaku