-
Notifications
You must be signed in to change notification settings - Fork 487
Use calc-size in .active > .nav-child
#849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 11959817132Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces JavaScript-based height calculations for TOC (Table of Contents) animation with the new CSS calc-size
function to improve accuracy and simplify the codebase. The change addresses issues with collapsed rows in the TOC animation that were present in the JavaScript implementation.
- Removes JavaScript height calculation logic for TOC navigation items
- Replaces CSS custom property
--height
with nativecalc-size(auto, size)
- Simplifies the transition properties by removing
visibility
handling
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
source/js/utils.js | Removes JavaScript height calculation and CSS custom property setting for TOC animations |
source/css/_common/outline/sidebar/sidebar-toc.styl | Replaces custom property height with calc-size and simplifies transition properties |
Comments suppressed due to low confidence (1)
source/css/_common/outline/sidebar/sidebar-toc.styl:47
- The
calc-size
CSS function is only supported in Chrome and Edge 129+, and not yet supported in Firefox or Safari. This will cause the TOC animation to break in unsupported browsers. Consider adding a fallback or waiting for broader browser support before merging.
height: calc-size(auto, size);
transition-property: height, opacity; | ||
transition: $transition-ease; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing visibility
from the transition properties may cause visual glitches during the animation. The visibility
property was likely included to ensure smooth show/hide transitions. Consider testing thoroughly across different browsers to ensure the animation remains smooth without it.
transition-property: height, opacity; | |
transition: $transition-ease; | |
transition-property: height, opacity, visibility; | |
transition: $transition-ease; | |
visibility: hidden; |
Copilot uses AI. Check for mistakes.
PR Checklist
PR Type
What is the current behavior?
#323 introduced a transition animation for TOC, and due to the need to calculate heights, the author @PaperStrike wrote the algorithm in JavaScript. However, it is not accurate when encountering collapsed rows (#772) and no better solution has been found. I noticed that this issue might be resolved using the newly introduced
calc-size
in CSS, but it is currently only supported by Chrome and Edge versions 129 and above (https://caniuse.com/mdn-css_types_calc-size). We may need to wait until it is supported by other mainstream browsers (such as Safari and Firefox) before merging. You are welcome to test the TOC animation effects on the latest versions of Chrome and Edge.Issue resolved:
What is the new behavior?
How to use?
In NexT
_config.yml
: