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

Title for the section still renders when editor panels are removed from UI #11923

Closed
gziolo opened this issue Nov 15, 2018 · 8 comments
Closed
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Bug An existing feature does not function as intended

Comments

@gziolo
Copy link
Member

gziolo commented Nov 15, 2018

Discovered when working on #11802.

When you remove all panels programmatically, the section title in the Options dialog is still there.

screen shot 2018-11-13 at 09 59 42

You can reproduce by pasting the following code and executing in JS console:

wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'taxonomy-panel-category' ) ;
wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'taxonomy-panel-post_tag' );
wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'featured-image' );
wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'post-excerpt' );
wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'discussion-panel' );

and opening Options modal from the More Menu.

@noisysocks shared some ideas how this could be fixed:

It's a shame that there's no way to ask React if props.children will render as empty...

I had a similar problem with <MetaBoxSection> and ending up having to add logic to the section rather than keeping it in each option.

I'm struggling to think of a nice way around this. Perhaps need to bite the bullet and move away from having <OptionsModal> implemented with nested components. Instead, we can have a function generate the options data which a dumb <OptionModal> component then renders a UI for.

@gziolo gziolo added [Type] Bug An existing feature does not function as intended Good First Issue An issue that's suitable for someone looking to contribute for the first time [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Feature] Extensibility The ability to extend blocks or the editing experience labels Nov 15, 2018
@mtias mtias added this to the WordPress 5.0.x Follow Ups milestone Nov 21, 2018
@gziolo
Copy link
Member Author

gziolo commented Dec 3, 2018

It looks like it is also the case for Advanced Panels, I noticed in the screenshot shared by @imath in #12394:

with

@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Apr 10, 2019
@paaljoachim
Copy link
Contributor

Is this issue still valid @gziolo Greg?

@gziolo gziolo added Needs Testing Needs further testing to be confirmed. and removed Needs Dev Ready for, and needs developer efforts labels Feb 22, 2021
@gziolo
Copy link
Member Author

gziolo commented Feb 22, 2021

@ntsekouras, is it something that can be closed after the most recent refactoring applied in #28329?

@ntsekouras
Copy link
Contributor

Problem is still there 😞 - I hadn't checked that.

@ntsekouras ntsekouras removed the Needs Testing Needs further testing to be confirmed. label Feb 22, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 22, 2021
@Mamaduka Mamaduka removed this from the WordPress 5.x milestone Jun 28, 2022
@Mamaduka
Copy link
Member

I can confirm this is still an issue in 6.0.

Snippet for testing.

const panels = ['post-link', 'template', 'taxonomy-panel-category', 'taxonomy-panel-post_tag', 'featured-image', 'post-excerpt', 'discussion-panel', 'page-attributes'];

panels.forEach( (panel) => wp.data.dispatch('core/edit-post').removeEditorPanel(panel) );

Screenshot

CleanShot 2022-06-29 at 10 06 39

@Mamaduka Mamaduka removed the [Status] In Progress Tracking issues with work in progress label Jul 5, 2022
@ntsekouras ntsekouras removed their assignment Jul 15, 2022
@Mamaduka Mamaduka removed the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Jun 13, 2023
@Mamaduka
Copy link
Member

Removing the "Good First Issue" label, as we found out that this isn't an easy fix 😅

@fabiankaegy
Copy link
Member

Following up from the comment here: https://github.com/WordPress/gutenberg/pull/29207/files#r581002056

I think this should now be possible using the CSS :has selector. has has shipped in most browsers. And even for the ones that don't this doesn't cause more harm. It at least solves the issue for a good majority of users.

@bph bph moved this from Triage to Todo in Increase Gutenberg Extensibility Jan 23, 2024
@ntsekouras
Copy link
Contributor

It seems the css solution has been implemented already, so I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Bug An existing feature does not function as intended
Projects
Development

Successfully merging a pull request may close this issue.

7 participants