[6.x] Fix nested <li> in the CP nav - #15402
Merged
Merged
Conversation
Nav.vue already wraps each nav item in an <li>, so the updates and duplicates nav views were producing <li><li>...</li></li> on every authenticated Control Panel page. Fixes statamic#15395 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013YZV7JD2cyMHSeSu2fUXCK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15395.
Nav.vuealready wraps every nav item in an<li>:https://github.com/statamic/cms/blob/v6.31.0/resources/js/components/nav/Nav.vue#L206-L208
The
updatesandduplicatesnav views each opened with their own<li>as well, so the rendered sidebar contained<li><li>…</li></li>on every authenticated Control Panel page:An
<li>whose parent is an<li>is not part of any list, so the item falls out of the list structure and screen readers announce the wrong item count for the navigation. WCAG 2.1 SC 1.3.1 (Level A).This PR removes the redundant wrapper from both views.
Nav.vue:208is the only consumer of$item->view(), so nothing else was relying on those views bringing their own<li>.Verification
Applied to a vanilla 6.31.0 install and re-checked three CP pages with axe-core:
<li>beforelistitem/listviolations after/cp/dashboard/cp/collections/cp/utilitiesThe Updates nav link still renders and still links to
/cp/updaterin each case.Notes
<li>in the views and drop it fromNav.vueinstead.