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

FSE: Hide the UI for the post content slot in the editor #35081

Merged
merged 3 commits into from
Aug 2, 2019

Conversation

apeatling
Copy link
Member

@apeatling apeatling commented Aug 2, 2019

Changes proposed in this Pull Request

The UI for the post content slot is not needed and distracts from editing the post content blocks themselves. This could change in the future if we add settings, but it is not true right now.

This PR adds a top level classname to the post content slot block, and uses that classname to hide the editor UI using CSS. It's a bit of a hack, although I'm not sure there is any other way of hiding block UI at this point (happy to be pointed to something).

Before:

Screen Shot 2019-08-01 at 9 41 19 PM

After:

Screen Shot 2019-08-01 at 9 40 51 PM

Testing instructions

  • Create or edit a new page, and confirm that you can select any block inside the page content area and not see any UI for the content slot block.
  • Click around different areas of the page and confirm at no point do you see content slot block UI, or any flashes of it.

Fixes #34889

@apeatling apeatling added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Goal] Full Site Editing labels Aug 2, 2019
@apeatling apeatling requested review from a team as code owners August 2, 2019 04:43
@apeatling apeatling self-assigned this Aug 2, 2019
@matticbot
Copy link
Contributor

…heet to the post content slot block stylesheet.
@apeatling apeatling removed the request for review from a team August 2, 2019 04:49
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@apeatling apeatling added the [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR label Aug 2, 2019
};
}, 'addContentSlotClassname' );

wp.hooks.addFilter(
Copy link
Contributor

Choose a reason for hiding this comment

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

For code consistency let's update this to

import { addFilter } from '@wordpress/hooks';
//...
addFilter(


return <BlockListBlock { ...props } className={ 'post-content__block' } />;
};
}, 'addContentSlotClassname' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice TIL, I didn't know about this one!

Copy link
Member Author

Choose a reason for hiding this comment

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

Nor did I! I found it by just scanning through all the available filters. I think this will come in handy for a couple of other issues. 👍

Copy link
Contributor

@gwwar gwwar left a comment

Choose a reason for hiding this comment

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

Thanks @apeatling this is good to 🚢 after the hooks syntax is updated 👍

Noting that it's still possible to see content slot block options (clicking next to page title), but we can fix that on a follow up.

content slot

@gwwar
Copy link
Contributor

gwwar commented Aug 2, 2019

Added #35094 for follow up

@apeatling apeatling merged commit a578767 into master Aug 2, 2019
@apeatling apeatling deleted the add/fse-hide-content-slot-ui branch August 2, 2019 19:44
@matticbot matticbot removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Aug 2, 2019
getdave pushed a commit that referenced this pull request Aug 13, 2019
* Hide the UI for the post content slot in the editor.

* Move the post content slot block UI CSS from the global editor stylesheet to the post content slot block stylesheet.

* Update to support external WordPress hooks dependency, props @gwwar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FSE: Content Slot block UI is confusing to users
3 participants