-
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
Filter out duplicate menu entries when creating a Nav block from existing menu #36311
Conversation
To be sure I understand this correctly, let me describe a flow and how I imagine this PR might handle it:
Is that correct? If so then that sounds good to me. I don't imagine importing legacy menus to be a common enough occurrence that you need access to them for all eternity, and simply filtering based on copied name seems like a fine way to make sure you choose the right one, the one that stays in sync. Let me know if that was helpful. |
@jasmussen not quite. Basically what happens is
What is happening on
My concern is that this is confusing because you see both the original Menu and the block-based version of that same menu. As people who worked on this feature we understand why that happens, but I suspect an average user will be quite confused with so many references to
However as @draganescu explains #36307 (comment) we need to be sure we're not stopping users from achieving other workflows. My suggestion in this PR is that if a copy of the classic Menu exists as a block-based menu then we filter it out of the list of Menus shown under the But...I'm open to alternative suggestions as I'm really not sure what the best UX here is. |
Ah, thanks for explaining. If we already make a migrated copy, do we need to also show the pre-migrated versions? If menus are already properly migrated, it seems like we wouldn't need any classic sub-section at all, or am I missing an aspect? |
I think that's the purpose of this change, to avoid showing the pre-migrated versions.
Currently not all menus are migrated, only those assigned to locations. But perhaps it's worth reconsidering that and migrating all menus and as you say there might no longer be a need to show classic menus in the placeholder. I think we'd need to consider the potential impact of that. Is there any situation in which a user might still need access to the classic menu. The permutations are a bit mind boggling when you consider hybrid/universal themes, as they might not go through the theme switching process 🤯. There is another option, which is a little more involved, but removes some risk, it would involve all of these steps:
|
Sorry for being so late to the party. If I have grasped the details of the problem, the solution that @talldan mentions in his last comment seems perfect to me as it is entirely transparent to the user. But if we were to show the classic menus, something that I think would make that placeholder less confusing would be to label those menus differently. I don't know if this is technically possible, but would it make sense to:
|
There's a problem with this. If we have a classic menu 'Main Menu' and the user selects it, that menu is migrated to a block menu. The system proposed would hide the classic version of 'Main Menu' and only show the block menu. But what happens then if I delete the block version of 'Main Menu'? The classic one shows in its place, which would seem really buggy. Like the delete didn't actually have any effect. Seems like it needs a bit more thought. |
Do we need a separate area in the UI for the action of "converting" a classic menu rather than "inserting" an existing block menu. Perhaps we're blurring things and the distinction afforded by separate UI would help? |
To implement @talldan 's solution, which I also think it would be the best experience, we need a way to keep track of which classic menus were converted. Doing a filtering out of classic menus that have the same slug (name+id) as a block one is a way but it's guesswork. |
So still show all the classic menus but only those which haven't already been migrated?
So yes, this seems to imply we'd still show classic menus (unless they have already been migrated). If the user selects one of these unmigrated menus then we'd convert it on the fly (at the point of selection). This needs a tracking mechanism. This isn't a priority for 5.9 so this is looking more and more like a 6.0 thing. |
We should pursue an alternative approach in a follow up PR because the consensus is leaning towards a more complex tracking mechanic. |
Description
In #36307 we learnt that because we're auto-creating copies of classic menus on Theme switch from classic -> block based theme, we end up with duplicate entries under the the
Create from existing menu...
option in the Nav block placeholder.This PR is a initial (possibly naive) attempt at resolving that situation by filtering out any classic menus that already have a block-based facsimilie.
Potential concerns
How has this been tested?
Select existing menu...
Classic Menus
(we've filtered those out).Menus
you should see entries for each of your classic menus (those you created above). These will be prefixed withClassic Menu:
- note this PR does not add that functionality.Bottom line: we're just verifying any classic Menus which have block-based facsimilies are not listed.
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).