-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update navigation editor to support new submenu block #34281
Conversation
Size Change: +19 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this so promptly! It's working well for existing submenus, but when adding a new one the inserter doesn't seem to be showing up in the submenu container.
There's an extra margin around the Submenu that's inherited from the general block styles, but that should be fixed once #34171 is merged.
Another thing I'm noticing is that in the conversion from Page List to editable links, the submenus are still being created with Navigation Link but I think that needs to be addressed in the parent PR - I forgot to make the necessary updates in the Page List block 😅
Good catch. I think the styles hide empty submenus by default, so that will require some tweaking. |
Ok, I've updated the Submenu PR to use Submenu in the Page List conversion, so this one should work correctly after rebasing. |
I tested this and like mentioned above there was no way to add an item in the submenu. |
942bee8
to
cd044db
Compare
5bd48ab
to
65e653a
Compare
Have updated this and gone a bit further to fix a lot of the broken navigation editor styles. Things should be much improved now. |
This fixes the broken nav screen rules for me, nice work: Because of those regressions, I wonder if we should extract some of those fixes and land them separately (and I'd be happy to help here). Per the discussion in #18395, #33775 could be one option for configuring submenus. But there are some styling issues which while they shouldn't necessarily be too hard to fix might nevertheless make it miss the next plugin release: I'll try and help here as best I can, but in case we'd like to fix the regressions in separately, that's also on offer. Let me know. |
I think it's ok to wait for the parent branch to be updated. There are a few CI issues as well to sort in that branch, but hopefully nothing major. |
3567cde
to
be6def2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working well! Just a couple minor comments below.
@@ -324,7 +324,7 @@ describe( 'Navigation editor', () => { | |||
|
|||
// Select a link block with nested links in a submenu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably update the comment to "submenu block".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done 👍
@@ -30,8 +30,10 @@ | |||
font-family: $default-font; | |||
|
|||
// Increase specificity. | |||
.wp-block-navigation-item { | |||
.wp-block-navigation-item, | |||
.wp-block-navigation-submenu { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this anymore because submenu blocks have both classnames as of #33918.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, done 👍
@@ -55,13 +57,13 @@ | |||
|
|||
// Menu items. | |||
// This needs high specificity to override inherited values. | |||
&.wp-block-navigation-item.wp-block-navigation-item { | |||
&.wp-block-navigation-item.wp-block-navigation-item, | |||
&.wp-block-navigation-submenu .wp-block-navigation-submenu { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one shouldn't be needed either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discovered I could remove the whole rule, it didn't seem to do anything as margin is set by a line further up 🤷
16a6998
to
898b476
Compare
898b476
to
df75aef
Compare
Isn't this a breaking change for classic menus? I mean, we don't expect Testing this with TT1 results in a pretty weird menu: and some weird markup:
|
@draganescu I don't think this changed anything, you could still create menu items without hrefs before this PR. Would you be able to share more details about what you're seeing? Unfortunately my dev environment needs to be fixed, so I'm unable to test. (When I last tested the submenu block still prompted with the URL Control upon creation. That might not be the case though if the implementation has changed in the submenu block.) |
Hmm, I was able to test and see what happens. For some reason the Link Control doesn't open straight away now, but if you click out and back into the submenu block it shows up. Seem like a bug with Submenu, it happens in the post editor too. I can take a look at a fix tomorrow, but an issue would be appreciated. |
What I mean is that in the classic navigation editor adding a custom link with no href is not possible. Initially. Hence I overreacted with the words "breaking change". Still it is possible to achieve an empty But now it's auto happening and I wonder if we increased our odds for themes to encounter surprise Maybe because it was hard to add a custom link without a href (although possible) many themes just expect href to be in menus. And what we do now with automatically making href-less anchors by adding a block is a very different thing. |
#18866 indicated that people have been using this as a roundabout way of creating non-link parents for submenus, so not allowing the behaviour at all is more of a breaking change 😅 I'll look into why the link control isn't opening at first; it should do so. |
#34798 should fix the issue. |
Based on and merges into #33775
Description
Updates the navigation editor to support the dropdown block.
The changes are:
How has this been tested?
trunk
.Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).