Skip to content

Keep code copy controls out of authored structure - #1561

Merged
max-sixty merged 4 commits into
mainfrom
fix/ci-36950226357-code-copy
Oct 2, 2026
Merged

max-sixty merged 4 commits into
mainfrom
fix/ci-36950226357-code-copy

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

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.

This was written by Codex on behalf of max-sixty

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 leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread skills/leaf/assets/runtime/code-copy.js Resolved
@max-sixty
max-sixty merged commit a0ef3df into main Oct 2, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix/ci-36950226357-code-copy branch October 2, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci-fix: code copy control changes authored sibling structure

2 participants