fix(html): make code-tools toggle work when code-copy is enabled#14707
Open
mcanouil wants to merge 1 commit into
Open
fix(html): make code-tools toggle work when code-copy is enabled#14707mcanouil wants to merge 1 commit into
mcanouil wants to merge 1 commit into
Conversation
The code-copy scaffold added in 1.8.15 wraps each code block in a div.code-copy-outer-scaffold, which left the "Show All Code" and "Hide All Code" handler matching nothing: its selectors assumed .sourceCode was a direct child of <details> and of .cell, and it reached the <details> via .parentElement. Key the selectors off details.code-fold and div.sourceCode.cell-code instead, which the scaffold cannot displace. Apply the same selector to the server-side toggle detection, which until now only worked because that post-processor happens to run before the scaffold is inserted.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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
code-copyscaffold introduced in 1.8.15 wraps each code block in adiv.code-copy-outer-scaffold, which broke the "Show All Code" / "Hide All Code" handler's direct-child selectors. The menu rendered but clicks did nothing. Selectors now key offdetails.code-foldanddiv.sourceCode.cell-code, which the scaffold cannot displace.<details>.echo: falsecells underkeep-hidden: true, broken the same way but not reported (found/verified during Claude's review).filename, and folded blocks inside tabsets, callouts and listings, which the old direct-child selector never reached.Verified in headless Chromium by clicking both menu items on a rendered document: all folded blocks open and close together and the hidden block flips both ways. Patching the selectors back to their previous form on the same page reproduces the inert behaviour.
Closes #13583.