Repository navigation
Put the page content before the navigation tree in the preview shell - #5023
Merged
Merged
Conversation
The preview shell wrote the navigation tree ahead of the page. On a large docset the tree is megabytes, so a crawler or LLM fetcher that stops early never reaches the article. The tree now follows the content in the markup, and `grid-area` keeps it in the left column, so the page looks the same. The docs shell and the API explorer shell both change. The legacy layouts already put the content first. `NavigationFollowsTheContent` guards the order. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…y Libra) The order test rendered the Markdown shell only, so moving the API explorer tree back ahead of the article left it green. `Layout_PutsTheNavigationAfterTheArticleWhenPreviewEnabled` renders the API layout with the preview on. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5023/ |
…iew by Libra) The drawer checkbox now comes before the article, not before the tree, so the next Tab after opening the drawer went into the page behind the scrim. `bindDrawerFocus` moves focus to the drawer's first control on open and back to the checkbox on close. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…view by Libra) Above 860px the sidebar is always open, but its transparent checkbox is still in the tab order, so a Space on it moved focus past the article into the sidebar. `bindDrawerFocus` now acts only when the `max-width: 860px` query matches. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…er review by Libra) Focusing the first control scrolled the tree back to the top on every reopen and, on a single-version API page, put focus in the "Jump to API" field, which raises a phone's keyboard. The drawer takes focus instead, so the tree keeps its scroll position and the next Tab reaches its first control. This answers both review threads, which have the same cause. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Once focus moves into the drawer, Space no longer reaches the checkbox and the drawer has no close control. Escape now closes it and the change handler puts focus back on the checkbox. A focus trap stays out of scope. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
The preview shell now writes the page content before the navigation tree in the HTML. A crawler or LLM fetcher that stops early gets the article, and the page looks the same.
Affects:
Site UI,API referencePart of: elastic/docs-eng-team#1183. This does not shrink any page. It puts the article before the navigation tree, so a cut at 2 MB takes the tree and not the content.
Prompt summary: Crawlers and LLM fetchers may never reach the main content of a docs page, because the navigation tree is huge. The ask is to check that idea, then move the navigation after the main content in the markup and restore the visual order with CSS.
Why
The preview shell (
NAVIGATION_PREVIEW) writes<aside class="layout__nav">ahead of<main>. The tree is large: on the assembled docs the navigation is about 98% of each page's bytes, so a fetcher with a size or token limit can cut the page off before the article. The legacy layouts already put the content first. The preview shell is the one that does not, and it is the layout the site is moving to.What
Docs shell
The navigation tree now follows the content and the rail in the markup. The tree moves from
_DesignSystemShellStart.cshtmlto_DesignSystemShellEnd.cshtml, just before the closing.layoutelement..layout__navalready takes its column throughgrid-area: nav, so no CSS changes and the page looks the same.API explorer shell
The preview branch of
src/Elastic.ApiExplorer/_Layout.cshtmlgets the same move. The nav stays a sibling of.layout__main, so the drawer toggle selector.layout__drawer-toggle:checked ~ .layout__navstill matches.Keyboard focus in the drawer
On a narrow screen the drawer opens from a checkbox. With the tree after the article, the next Tab after opening went into the page behind the scrim.
bindDrawerFocusinds/nav.tsnow moves focus to the drawer itself when it opens, so the next Tab reaches its first control, the tree keeps its scroll position and no search field raises a phone's keyboard. Escape closes the drawer and focus returns to the checkbox. Above the 860px breakpoint the handler does nothing. It keys on the#pages-nav-hamburgerand#pages-navids, which both shells share.Order tests
NavigationFollowsTheContentasserts thatid="pages-nav"comes after the closing</article>in the docs shell.Layout_PutsTheNavigationAfterTheArticleWhenPreviewEnabledasserts the same for the API layout. Each fails on the old order.Out of scope: The navigation tree is still the same size. Shrinking it, and compressing HTML for
/docsat the CDN, would help more and are separate changes. The legacy layouts keep the same drawer focus behaviour as before. The drawer has no focus trap, so Shift+Tab from it still reaches the article.Verify
The article offset is lower than the navigation offset. At desktop, tablet and mobile widths the page matches main, apart from 6 pixels of anti-aliasing on one icon. At 600px, focus the menu checkbox and press Space, then Tab: focus stays inside the drawer. Escape closes it and focus returns to the checkbox.
🤖 Generated with Claude Code