fix: point the fold chevron down in RTL books - #3190
Merged
Conversation
the expanded chevron is rotated 90 degrees, which points it up once the browser has already mirrored the glyph for a right-to-left document. Rotate the other way there. Fixes rust-lang#2894.
Member
|
Please share screenshots of the bug and with your fix applied. |
Contributor
Author
Contributor
Author
|
Here you go. Same RTL book built twice, the two builds differ by exactly the 6 CSS lines in this PR (verified with Before, the chevron points up: After, it points down: The computed transform is |
GuillaumeGomez
approved these changes
Aug 18, 2026
Member
|
Thanks! |
GuillaumeGomez
added this pull request to the merge queue
Aug 18, 2026
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.






Fixes #2894.
Cause
The expanded chevron is rotated 90°:
In an RTL document the browser has already bidi-mirrored the
❱glyph, so it points left before any rotation. Rotating that by +90° points it up, which is the "^" in your report.Collapsed is fine as-is — the mirroring alone is exactly what's wanted there.
Fix
One rule, mirroring the existing one:
Computed transform on an expanded toggle in an RTL book goes from
matrix(0, 1, -1, 0, 0, 0)tomatrix(0, -1, 1, 0, 0, 0). LTR is untouched — I captured every toggle's computed transform with and without the change and diffed: byte-identical.Checked rather than assumed
toc.js.hbsappends them into the samespan.chapter-link-wrapperinside.chapter, so the selector matches. I built a book withsidebar_header_navand h3/h4/h5 nesting and confirmed the computed transform on a header toggle.Test
tests/gui/rtl-fold.gomlwith a small RTL fixture book. GUI tests run here (npm install+npx puppeteer browsers install chrome):Load-bearing — stashing only the CSS change:
One gap worth naming: the fixture has no h3+ headings, so the test doesn't cover the JS header toggles, even though the fix applies to them. Happy to extend it if you'd like that pinned too.
No CHANGELOG entry, since CONTRIBUTING says those are generated at release time.