Skip to content

Navigation block: Unable to use sub-menu item & deletion deletes parent menu #36977

Closed

Description

@annezazu

Description

When using the Navigation block and added sub-menu items, I noticed that there appears to be a regression in behavior where I'm unable to see the sub-menu item upon addition and, if I remove it, it also removes the parent menu item.

Step-by-step reproduction instructions

  1. Add a navigation block.
  2. Add a few menu items.
  3. Add a sub menu item.
  4. See initial state where you can't seem to add in a link to the sub menu container.
  5. Try to delete the sub menu item and notice it deletes the parent.

Screenshots, screen recording, code snippet

sub.menu.item.mov

Environment info

  • WordPress 5.9-alpha-52262
  • Gutenberg 12.01
  • TT1 blocks
  • Chrome

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

  1. ghost added
    [Type] Bug
    on Nov 29, 2021
  2. ghost added
    [Block] Navigation
    on Nov 29, 2021
  3. annezazu commented on Nov 29, 2021

    @annezazu
    ContributorAuthor

    Previous sub menu item behavior:

    https://user-images.githubusercontent.com/26996883/143949011-f22b5994-efd4-48b4-a27e-1c69abc65637.mov

    Marking this as a regression for now!

  4. ghost added
    [Type] Regression
    on Nov 29, 2021
  5. jasmussen commented on Nov 30, 2021

    @jasmussen
    Contributor

    Yes indeed. This appears to be a side effect of showing the block toolbar below the block if the block is near the top of the screen, as ticketed in #29464. The behavior, I feel, still makes sense to have for blocks that truly bump against the edge; for example some of the TT2 patterns go all the way to the top for the header template parts.

    CC: @Addison-Stavlo: do you recall if there are some levers we can adjust to this behavior? Also CC: @jameskoster, because an alternative fix might be to introduce the dark gray frame after all. I don't necessarily love doing this as it reduces the available real estate, but in weighing trade offs, it might be an option.

  6. jasmussen commented on Nov 30, 2021

    @jasmussen
    Contributor

    Another solution which might actually be better than the above is to change back the block toolbar absorbtion. Right now the block toolbar of submenu items is absorbed in the top toolbar, as opposed to being positioned near the block. This is ticketed separately as being a bit confusing due to the lack of spatial context. But in this case it might also mitigate the issue, as there would most likely be clearance enough above the selected first submenu block to accommodate the toolbar without bumping it below. CC: @getdave in case you have thoughts.

  7. getdave commented on Nov 30, 2021

    @getdave
    Contributor

    ...to change back the block toolbar absorbtion. Right now the block toolbar of submenu items is absorbed in the top toolbar

    As far as I remember it's a one liner fix. Simply remove this line

    __experimentalCaptureToolbars: orientation !== 'vertical',

    Other than that it's a UX concern. When we introduced the capture toolbars the UX with the toolbar locked to the nested submenu was very poor. If that's improved then we might benefit from removing the capturing behaviour on this block. I'll leave that decision to design folks though 🙇

  8. jasmussen commented on Nov 30, 2021

    @jasmussen
    Contributor

    Oh thank you, both for the fast response and the code piece.

    It was definitely needed, back in the day! Every block had borders around them, and there was a great deal of UI weight to deal with. I do think we've definitely reached a point where the UI can handle it. The one thought I still have attached to this is that we might still want the submenu block to capture the toolbars, instead of the navigation block, the idea being that as you build out the submenu, it can be helpful to see the preceding menu.

    Seeing as it's only applied when horizontal, I took the vertical version for a spin:
    vertical

    I think it's okay, and that if it helps mitigate this issue, it might be worth it.

  9. jameskoster commented on Nov 30, 2021

    @jameskoster
    Contributor

    Also CC: @jameskoster, because an alternative fix might be to introduce the dark gray frame after all.

    FWIW, adding the frame in the Site Editor is also a consideration for https://github.com/WordPress/gutenberg/issues/36535.

  10. Addison-Stavlo commented on Nov 30, 2021

    @Addison-Stavlo
    Contributor

    @Addison-Stavlo: do you recall if there are some levers we can adjust to this behavior?

    I do not, unfortunately. There could be someway to go about that with more digging, but nothing I remember at a glance.

    we might still want the submenu block to capture the toolbars, instead of the navigation block

    I think this makes a lot of sense. If the toolbar is not positioned with respect to the selected block (the submenu in this case), then I think it becomes increasingly difficult for the toolbar to behave in a manner that is non-intrusive in all cases.

  11. talldan commented on Dec 1, 2021

    @talldan
    Contributor

    I also made an issue about this - https://github.com/WordPress/gutenberg/issues/36335

    It isn't just an issue in the nav block, we should also consider that positioning the toolbar under the block might be a problem for third-party blocks too. Any block that overflows its container like the nav block does will have this issue.

  12. Addison-Stavlo commented on Dec 1, 2021

    @Addison-Stavlo
    Contributor

    positioning the toolbar under the block might be a problem for third-party blocks too. Any block that overflows its container like the nav block does will have this issue.

    Technically couldn't a 3rd party block could also overflow its container from above? In that case positioning it above the block would have the same issue.

    This does seem difficult to handle well. Right now, bottom positioning should only happen if there isn't enough room for top positioning to happen without the toolbar obstructing the selected block. With the previous always-top positioning, there were instances where the toolbar would cover the navigation block itself when selected (and other blocks as well) which is why we tried moving it beneath the selected block when this would be the case. The bottom positioned toolbar can obstruct blocks that overflow their boundaries, but that seems less of an issue than the toolbar obstructing inside the well defined boundaries of the selected block itself (but still something we need to figure out how to handle). 🤔

    Another idea might be that when the toolbar would obstruct the given block boundaries, instead of moving the toolbar below the block we move it into the fixed top-toolbar location. However, this would be a lot more 'jumpy' in editor interaction that I assume would not feel very favorable to folks either.

  13. noisysocks commented on Dec 1, 2021

    @noisysocks
    Member
  14. jasmussen commented on Dec 8, 2021

    @jasmussen
    Contributor

    Outside of completely disabling the "show toolbar below block" feature, is it possible to add an edgebuffer so it only activates when the block is most literally touching the top edge? For example for header template parts?

  15. talldan commented on Dec 8, 2021

    @talldan
    Contributor

    Technically couldn't a 3rd party block could also overflow its container from above? In that case positioning it above the block would have the same issue.

    I don't think many would do that because the toolbar has always been above the block.

  16. 23 remaining items

  17. ghost closed this as completedon Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Navigation[Type] Bug[Type] Regression

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions