Shared navigation entity: editor label-box typography from one menu leaks onto another menu's items in the canvas
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 54/100
Research direction
Start with NavigationPatternContext::navigationAnchorBoxes() and GeneratedSupportStylesheetState::navigationEditorTypographyRules(), then compare the editor rules with the frontend rules scoped by navigation instance. Check how NavigationEntityProjection::sharedItemClasses() preserves markers on shared items. Done when each navigation reference in the editor canvas uses its own typography, matching the frontend behavior; the issue names no test file.
Written by the indexing model from the issue text.
Description
Summary
When two menus with the same items are factored into one shared wp_navigation entity, the editor-only label-box typography rule from one menu leaks onto the other menu's items in the editor canvas. A header menu that renders at 14px sans-serif on the frontend renders at 28px in the footer menu's font in the canvas. In the real import this makes items wrap ("My Vlog" breaks onto two lines).
Reduced fixture
D2-shared-nav-typography.html: a header menu (font size set on the li), and a footer menu with the same four links, where each link sits inside li > div > span boxes and has its own 28px Georgia typography.
<!doctype html><html><head><meta charset="utf-8"><title>Menus</title><style>
body{margin:0;font-family:sans-serif}
.top{display:flex;justify-content:flex-end;padding:20px 40px}
.top ul{display:flex;gap:20px;list-style:none;margin:0;padding:0}
.top li{font-size:14px}
.top a{color:#222;text-decoration:none;white-space:nowrap}
footer{padding:20px 40px;background:#f4f4f4}
.side ul{list-style:none;margin:0;padding:0}
.side .box{padding:0 10px;border-bottom:1px solid #ccc}
.side .wrap{display:inline-block}
.side a{font-family:Georgia,serif;font-size:28px;line-height:56px;color:#333;text-decoration:none}
</style></head><body>
<header><nav class="top"><ul>
<li><a href="/">Home</a></li><li><a href="/alpha">Alpha Page</a></li><li><a href="/beta">Beta Page</a></li><li><a href="/gamma">Gamma Page</a></li>
</ul></nav></header>
<main><h1>Welcome</h1><p>Body text.</p></main>
<footer><nav class="side"><ul>
<li><div class="box"><span class="wrap"><a href="/">Home</a></span></div></li><li><div class="box"><span class="wrap"><a href="/alpha">Alpha Page</a></span></div></li><li><div class="box"><span class="wrap"><a href="/beta">Beta Page</a></span></div></li><li><div class="box"><span class="wrap"><a href="/gamma">Gamma Page</a></span></div></li>
</ul></nav></footer>
</body></html>
Observed (1440px window)
header menu item .wp-block-navigation-item__content |
frontend | editor canvas |
|---|---|---|
| font-size | 14px | 28px |
| font-family | sans-serif | Georgia, serif |
| "Alpha Page" width | 72px | 139px |
The footer menu is correct on both surfaces (28px Georgia).
Both references point to one entity. That entity's items carry both menus' anchor subject markers:
<!-- wp:navigation-link {"className":"blocks-engine-navigation-item-15972ce37e04-0 blocks-engine-navigation-anchor-b1869fbf8260-0 blocks-engine-navigation-anchor-43176dbb06d3-0","label":"Home",…} /-->
The editor static-state sheet contains this rule, and it is not scoped to a navigation instance:
.wp-block-navigation .wp-block-navigation-item.blocks-engine-navigation-anchor-43176dbb06d3-0 .wp-block-navigation-item__content{font-family:…Georgia,serif;font-size:…28px;line-height:56px;color:…#333}
In the canvas it matches the header menu's items too, because they render the same entity items with the same marker. On the frontend, the matching rules are scoped with .wp-block-navigation.blocks-engine-navigation-instance-<id>-0, so they only bind inside their own reference.
Root cause
NavigationPatternContext::navigationAnchorBoxes()(~L1391–1406) registers editor typography for an anchor that has retained boxes, viaGeneratedSupportStylesheetState::registerNavigationEditorTypography().GeneratedSupportStylesheetState::navigationEditorTypographyRules()(~L127–138) emits.wp-block-navigation .wp-block-navigation-item.<anchor-marker> .wp-block-navigation-item__content{…}with no navigation-instance scope.NavigationEntityProjection::sharedItemClasses()(#4982) keeps every reference's subject markers on the shared entity items. Its docblock relies on "its item rules are scoped by its navigation instance, so they bind only inside that reference". That holds for the frontend rules but not for these editor typography rules (#4536).
Expected
The editor canvas renders each navigation reference with its own typography, the same way the frontend does. The editor label-box typography rules should carry the same navigation-instance scope as the frontend rules, or the shared entity should not expose another reference's marker to them.
Related: #4536, #4982, #4386.
Reduced and filed with AI assistance (Claude, via coding agent).
- Dominant language
- PHP
- Stars
- 28
- Forks
- 5
- Avg merge
- 2h 59m
- Merged PRs (30d)
- 942
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Automattic/blocks-engine#6318 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/blocks-engine#4943 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/blocks-engine#4942 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#4921 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
TYPO3-Solr/ext-solr#4850 ·
Maintainers usually reply within 2 days
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Opensync-en
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Opensync-en
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
glpi-project/glpi#26353 · 2 comments ·
Maintainers usually reply within 1 day