-
Notifications
You must be signed in to change notification settings - Fork 4.6k
FullscreenMode: remove the is-fullscreen-mode CSS class from body on unmount #26103
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
Conversation
|
Size Change: +31 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
|
|
||
| if ( this.props.isActive ) { | ||
| document.body.classList.remove( 'is-fullscreen-mode' ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rewriting that component as hook is probably the best path forward. At the time we introduce this one, these were not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. With useEffect, the code will be much shorter. I'll do it in the next PR. In this one, I wanted to focus on the actual bugfix.
youknowriad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The
FullscreenModecomponent adds theis-fullscreen-modeCSS class tobodywhen mounted withisActive={ true }, adds and removes when theisActiveprop changes, but doesn't remove it when the component is unmounted.This bug is not currently observable because the editor is always running in
wp-admincontext, mounted only once and never unmounted. As soon as theFullscreenModecomponent is used in a SPA with client-side router, unmounting on navigation to a different route would leave a staleis-fullscreen-modeclass behind.