-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Toggle Distraction free mode mode based on compatibility #54030
Conversation
@@ -295,6 +286,9 @@ function useEditUICommands() { | |||
label: __( 'Toggle top toolbar' ), | |||
callback: ( { close } ) => { | |||
toggle( 'core/edit-site', 'fixedToolbar' ); | |||
if ( isDistractionFree ) { |
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.
For now this is the only one left from the issue, because we call directly the preferences
store action.
Size Change: -116 B (0%) Total Size: 1.51 MB
ℹ️ View Unchanged
|
ac1e429
to
547c8c9
Compare
Flaky tests detected in 547c8c998aa6ebe99b4b4ef4fbb4a94ab30a0888. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6014986504
|
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 like this as it reduces code surface in many places where for now we need to disable distraction free mode. In the future when we'll be able to show sidebars (maybe using floating UI) we'll have only one thing to remove.
547c8c9
to
b21ee24
Compare
What?
Part of: #53993
Distraction free mode in combination with some commands/shortcuts etc may cause layout corruption. This is mostly due to the fact that DFM expect there are no sidebars opened. Currently in trunk we handled some of these cases by manually closing those sidebars and toggling some settings like the top toolbar. In order to avoid having to do this every time we need to, I've moved this logic in some of the actions.
This PR handles most of the cases in
site editor
only and a very similar PR will be needed forpost editor
too.Testing Instructions for site editor
Test when we enable DFM either through shortcut, command or in header options, any sidebar is closed.
Whenever we toggle the DFM observe that a snackbar appears with related information.
Test the following commands when DFM is on and observe that the sidebars are closed: