Skip to content
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

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion edit-post/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function VisualEditor( { hasFixedToolbar, isLargeViewport } ) {
<WritingFlow>
<PostTitle />
<BlockList
showContextualToolbar={ isLargeViewport && ! hasFixedToolbar }
Copy link
Member

@aduth aduth Mar 2, 2018

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

https://en.wikipedia.org/wiki/De_Morgan%27s_laws

Copy link
Contributor Author

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.

Copy link
Member

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 } />

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks

showContextualToolbar={ ! isLargeViewport || ! hasFixedToolbar }
renderBlockMenu={ ( { children, onClose } ) => (
<Fragment>
<BlockInspectorButton onClick={ onClose } />
Expand Down