Skip to content

After unpinning a PluginSidebar, there's no way to get it back #14457

Closed

Description

@mboynes

If a user accidentally or deliberately unpins a plugin sidebar (PluginSidebar component) that doesn't also add a "More menu item" (PluginSidebarMoreMenuItem component), that sidebar appears to be lost for that user. In addition, there doesn't appear to be a way to disable the ability to unpin a sidebar.

To Reproduce

  1. Create a plugin with a PluginSidebar component
  2. Display that plugin sidebar and then unpin it
  3. You can no longer get back to that sidebar

Expected behavior

Either,

  1. Gutenberg provides a separate UI to view/open unpinned sidebars, e.g. in the "Options" modal
  2. "Unpinning" is an opt-in feature for PluginSidebar, so developers can opt to allow that if they're also adding another way to get to that sidebar, e.g. via PluginSidebarMoreMenuItem

Duplicates #14211, but I have no way to reopen that so I'm submitting it anew.

Activity

  1. added
    Gutenberg Plugin
    [Feature] Plugins API
    on Mar 17, 2019
  2. swissspidy commented on Mar 17, 2019

    @swissspidy
    Member

    Can we make it mandatory to use PluginSidebarMoreMenuItem or at least educate developers through documentation?

  3. mboynes commented on Mar 17, 2019

    @mboynes
    ContributorAuthor

    While developer education could help, I think this is something Gutenberg should “just do” to provide a better developer experience.

    The pinning feature seems half-developed to me as-is. Since the editor is providing the “unpin” feature, I think the right approach is for the editor to also provide a list of unpinned items so users can see and open them.

  4. added
    [Feature] Extensibility
    on Mar 22, 2019
  5. gziolo commented on Mar 22, 2019

    @gziolo
    Member

    @jasmussen, any thoughts on how to solve it? Enforcing the menu item would be a breaking change at this point. What if we offer a prop for the sidebar component which would add the menu item behind the scenes. So based on this example from e2e test:
    https://github.com/WordPress/gutenberg/blob/master/packages/e2e-tests/plugins/plugins-api/sidebar.js#L85-L102

    we could have:

    <PluginSidebar
    	name="title-sidebar"
    	title={ __( 'Sidebar title plugin' ) }
    	moreMenu
    >
    	<SidebarContentsWithDataHandling />
    </PluginSidebar>
  6. jasmussen commented on Mar 25, 2019

    @jasmussen
    Contributor

    any thoughts on how to solve it? Enforcing the menu item would be a breaking change at this point.

    Why is this a breaking change?

    I do apologize for not having followed the intricacies of this along the way, but it was my impression that it was the case that any plugin that registered a sidebar must also have a menu item, this was a key part of the initial design and more or less the whole reason for plugins also having a menu item in the first place.

    In other words, I feel like the correct solution is to enforce that. A plugin that registers a sidebar must also have a menu item.

    The question then becomes: how can we enforce that? Is there a creative way we can do this without this being a breaking change? Can we smartly detect that a sidebar is present, and create the menu item for the plugin?

    Inversely, a plugin that registers a sidebar, should not be able to not have a menu item. The two should be strongly linked.

  7. gziolo commented on Mar 26, 2019

    @gziolo
    Member

    Inversely, a plugin that registers a sidebar, should not be able to not have a menu item. The two should be strongly linked.

    We didn't make this assumption initially so you can have your sidebar without a menu item. Why we can enforce it technically because there are no technical limitations to do so, the issue is that it's quite complicated to detect whether such menu item was already defined by the plugin. In other words, if a plugin defines the menu item and we enforce it from the sidebar, you could have the case where the menu item duplicates. I would rather avoid a situation and come up with a solution where it's easier to enable the menu item when you use the sidebar.

  8. jasmussen commented on Mar 26, 2019

    @jasmussen
    Contributor

    Given the situation, we should definitely explore creative solutions. But I really do feel like the right solution is that every sidebar plugin should have a menu item, so I would encourage brainstorms that move in that direction.

    Plan C (let's think of better options before going here) could be to create a new section in the menu called "Closed Sidebars", and every sidebar that gets closed shows up here as a menu item. Sidebars that already register their own menu item could either then:

    • not show up there, if we could do that automatically
    • opt out of showing up there in a new plugin update, and show up twice until they do
  9. mboynes commented on Mar 26, 2019

    @mboynes
    ContributorAuthor

    An alternate plan C, which might be easier, could be to make "pinning" an opt-in feature. e.g. <PluginSidebar pinnable />.

  10. gziolo commented on Mar 29, 2019

    @gziolo
    Member

    I will think about it and get back with some proposal after WordPress 5.2 RC. The more I think about it, the more viable your proposals are. We already have isPinnable prop which can be used to disable pinning:
    https://github.com/WordPress/gutenberg/blob/master/packages/edit-post/src/components/sidebar/plugin-sidebar/index.js#L24

    We could reuse it to reason about menu items. The biggest challenge is how to detect whether there is another menu item present for the existing plugins. I'm positive we can tweak codebase to make it possible to filter out duplicates :)

  11. oandregal commented on May 15, 2019

    @oandregal
    Member

    Wanted to note here that the Sidebar tutorial might need tweaking if we change the behavior (see #15638).

  12. conanliuhuan commented on Aug 14, 2019

    @conanliuhuan

    I have the same problem

  13. removed
    Gutenberg Plugin
    on Oct 10, 2019
  14. added
    [Status] In Progress
    on Feb 17, 2021
  15. gziolo commented on Feb 17, 2021

    @gziolo
    Member

    I opened #29081 that is going to resolve this issue.

  16. Baelx commented on Jun 1, 2022

    @Baelx
    Contributor

    While developer education could help, I think this is something Gutenberg should “just do” to provide a better developer experience.

    The pinning feature seems half-developed to me as-is. Since the editor is providing the “unpin” feature, I think the right approach is for the editor to also provide a list of unpinned items so users can see and open them.

    I agree with @mboynes in that this feature seems half-baked. And while I appreciate action was taken to make it possible to re-pin sidebar buttons, I think a setting buried in a menu is still not as friendly as it could be to users.

    I think a separate issue should be opened to address the value delivered by such a prominent "unpin" button. I think it's way more likely that users will accidentally press it than to use it for its intended purpose. Why make it so prominent in the first place? Are most users really that concerned with managing sidebar buttons in the Gutenberg editor? I think the feature should be designed around user need and I would argue that most users will just want to use the content of a whichever plugin sidebar is activated, rather than manage its visibility.

    As suggested by @mboynes, a menu to show the list of pinned and unpinned sidebar buttons would be great for this. That way it serves users that are specifically looking for that feature instead of the current system which - in my opinion - makes it easy for a broad set of users to activate a feature they don't need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Extensibility[Feature] Plugins API[Status] In Progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions