docs(hydrogen): mark the current page in the sample nav - #760
Draft
romain-pm wants to merge 1 commit into
Draft
Conversation
This was referenced Aug 23, 2026
commit: |
romain-pm
force-pushed
the
feat/link-api
branch
from
August 23, 2026 19:19
f598987 to
8a24e44
Compare
romain-pm
force-pushed
the
feat/hydrogen-navbar-jlink
branch
from
August 23, 2026 19:19
f8d9d21 to
281b2cc
Compare
romain-pm
force-pushed
the
feat/link-api
branch
from
August 23, 2026 22:21
8a24e44 to
d1656c2
Compare
The nav decided the current page with `page === mainNode`, reference equality on two Graal host proxies, which are never the same object — so aria-current never appeared. JLink compares identifiers. Marking the current page makes the fragment depend on the main resource, which is not part of the cache key unless the view says so, hence cache.mainResource. Refs #759
romain-pm
force-pushed
the
feat/hydrogen-navbar-jlink
branch
from
August 23, 2026 22:21
281b2cc to
1a43a3f
Compare
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.
Summary
Makes the current page actually show as current in the hydrogen navigation. Stacked on #751; the diff here is nine lines in one sample file.
Why
The nav marked the current entry with
aria-current={page === mainNode ? "page" : undefined}. Both sides are Graal host proxies wrapping a JCR node, and two proxies for the same node are not the same object — so the test never passed andaria-currentnever appeared.<JLink>compares identifiers instead.Changes
<JLink node={page} />. No children, so the label comes from the page's displayable name.properties: { "cache.mainResource": "true" }. Current-page state is a function of the main resource, andPathCacheKeyPartGeneratorleaves the main resource out of the fragment cache key unless the view opts in — so without this the nav would be cached once and replayed on every page with the same entry marked current. Nothing in this monorepo declared the property before; core declares it onjnt_navMenu,jnt_areaand the other main-resource-dependent views, and Jahia/luxe-jahia-demo declares it on its own nav.Validation
tsc --noEmitonsamples/hydrogenandeslintboth clean, against the library built from this branch.prettier --checkclean.AbsoluteArea, assertingaria-currentfollows the page. That is hydrogen NavBar: current-page state that actually works, and is cached correctly #759's third box and cache.mainResource: make current-page state safe to cache #755's Cypress case.Why it is separate from #751
#751 adopts the API mechanically. This changes what the reference sample renders —
aria-currentappears where it never did, on the navigation every new module copies — and it introduces a caching rule the docs have never stated. Worth its own review rather than one line in a 12-file diff.Part of #759. Depends on #751.