-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Toolbar: Do not hide the block toolbar on mobile #5349
Conversation
You are THE BEEEST! This fixes it for me. 👍👍👍👍 |
Related: #5206 |
So what was intended by gutenberg/edit-post/store/selectors.js Lines 136 to 145 in 9162e4c
|
So it appears after these changes, the fixed toolbar appears in mobile. But prior to #5206, even if the "Fixed toolbar" setting was somehow selected (it's hidden on smaller displays), it would still show the contextual toolbar. |
@@ -29,7 +28,7 @@ function VisualEditor( { hasFixedToolbar, isLargeViewport } ) { | |||
<WritingFlow> | |||
<PostTitle /> | |||
<BlockList | |||
showContextualToolbar={ isLargeViewport && ! hasFixedToolbar } |
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 the issue was a failure to preserve the original condition here.
Previously:
! isMobile( state ) && isFeatureActive( state, 'fixedToolbar' )
This should have translated to:
! isLargeViewport || ! hasFixedToolbar
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 tried this condition and it's showing two toolbars on small viewports at the same time.
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 tried this condition and it's showing two toolbars on small viewports at the same time.
Only because of the other changes in HeaderToolbar
on this branch.
Apply this diff to master, and it behaves as I'd expect:
diff --git a/edit-post/components/visual-editor/index.js b/edit-post/components/visual-editor/index.js
index 1d621863a..a439953e3 100644
--- a/edit-post/components/visual-editor/index.js
+++ b/edit-post/components/visual-editor/index.js
@@ -29,7 +29,7 @@ function VisualEditor( { hasFixedToolbar, isLargeViewport } ) {
<WritingFlow>
<PostTitle />
<BlockList
- showContextualToolbar={ isLargeViewport && ! hasFixedToolbar }
+ showContextualToolbar={ ! isLargeViewport || ! hasFixedToolbar }
renderBlockMenu={ ( { children, onClose } ) => (
<Fragment>
<BlockInspectorButton onClick={ onClose } />
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.
Gotcha, thanks
I need some clarification on the desired behavior here. For me, the current one in this PR is good but is this what we want? cc @jasmussen |
5dbf02d
to
464cc4e
Compare
Ok so I guess the idea is to avoid the fixed toolbar entirely on mobile. It should be good now. |
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.
👍
closes #5346
When introducing the
viewport
module, the block toolbar has been hidden in mobile. I don't know the exact reasons for this but I think we still want it in mobile. So I'm bringing it back here.Testing instructions