Repository navigation
Keep code copy controls out of authored structure - #1561
Merged
Merged
Conversation
Move document code-copy controls into Leaf chrome while retaining CSS anchor placement. A code block offers an Enter route to the control, and touch focus continues to uncover its words. Update the browser journey for the new ownership and verify the source, revision, touch, and keyboard behavior.
leaf-agent
commented
Oct 2, 2026
leaf-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
After Enter moves focus from a document code block to its copy button in .lf-chrome, the next Tab wraps to “Skip to Leaf controls” at the top of the page. I reproduced this on the visible code block in command-hub. The control needs a way to return keyboard navigation to the source’s place in the document, so copying code does not strand a reader away from the content that follows it.
leaf-agent
commented
Oct 2, 2026
leaf-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
Enter on a link inside an authored <pre><code> bubbles to this handler, which prevents the link's default action and moves focus to Copy. A browser test with a nested link reproduces the failure. The handler should take Enter only when the code block itself has focus.
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 main CI run failed four page render cases because the runtime inserted each generated code copy button beside an authored
<pre>, changing its section's child and sibling structure. Document code copy controls now live in Leaf's chrome with a CSS anchor at the code block. Enter on a focused code block reaches its copy button; touch keeps code text available for selection. An offscreen anchor fallback also removes the control from the viewport while its disclosure or tab hides the source, and restores it when the source returns. Fixes #1545.The copy journey passes with exact copied source, scrolling, revisions, keyboard focus, touch selection, and cleanup. All four reported render-gate cases pass. Two added touch cases cover closing and reopening disclosures and switching tabs, including copying after reopening. Pre-commit passes. The original served corpus startup comparison measured 250 requests in each arm and 2.7 KB more transferred in the candidate, including 2.4 KB more decoded script; that work supplies the keyboard route and preserves page-authored selectors. The hidden-source follow-up changes CSS positioning only.