fix: stabilize Examples page layout and sidebar scroll in Firefox#160
Open
julien-deramond wants to merge 1 commit intoapache:gh-pagesfrom
Conversation
Signed-off-by: Julien Déramond <julien.deramond@thalesgroup.com>
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.
This PR fixes the sidebar navigation and scrolling behavior in Firefox on the “Examples” page by:
activeItem.click()call from the hashchange handler that caused redundant scroll animations and misalignment in Firefox.After this fix:
It might fix apache/echarts#20423
Issue
On Firefox (150.0.1 aarch64 macOS 26.4.1), here's the current User eXperience at https://echarts.apache.org/examples/en/index.html
Screen.Recording.2026-05-07.at.09.58.31.mov
On Firefox (150.0.1 aarch64 macOS 26.4.1), here's the new behavior (run locally with
npm run dev):Screen.Recording.2026-05-07.at.10.00.53.mov
Fix Details
1. Layout: switch from float to flexbox
Previously, the main scroll container
#example-explorewas:overflow-y: auto.#left-container) that usedfloat: left+position: sticky.#explore-container) offset usingmargin-left.This combination (
absolute+float+sticky) apparently caused Firefox to miscompute the scrollable area: when scrolling down, you could see a large blank gap in the viewport while sections like “Bar” stayed stuck at the bottom instead of scrolling up, even though it worked in Chrome.The suggested fix:
#example-explorea flex container and remove float.margin-leftUsing flexbox here gives a clear, predictable layout for both Firefox and Chrome: the sidebar and content sit side-by-side, the scroll container is unambiguous, and sections scroll normally without blank gaps.
2. Remove redundant
activeItem.click()on hashchangeIn
Explore.vue, the hashchange handler used to callactiveItem.click(). From my understanding, it meant:vue-scrollactivealready initiated a scroll to the target.onHashChange, which called.click()again, starting a second scroll animation.The fix:
activeItem.click()call and letvue-scrollactivehandle the initial scroll.onHashChangeresponsible only for keeping the left nav’s own scroll aligned:This eliminates redundant scroll animations and prevents Firefox from “over-scrolling” or snapping back to the wrong section after layout changes.