-
Notifications
You must be signed in to change notification settings - Fork 4k
Show slider tick labels on hover #12367
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
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
✅ PR preview is ready!
|
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 implements a feature to show slider tick labels (min/max values) on hover, improving user experience by providing visual feedback when interacting with sliders.
- Adds hover state management to show/hide tick labels with smooth transitions
- Implements a new
SliderTickBarcomponent to display formatted min/max values - Includes comprehensive test coverage for both unit and e2e scenarios
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/lib/src/components/widgets/Slider/styled-components.ts | Adds styled component for tick bar with hover-based opacity transitions |
| frontend/lib/src/components/widgets/Slider/Slider.tsx | Implements hover state management and SliderTickBar component integration |
| frontend/lib/src/components/widgets/Slider/Slider.test.tsx | Adds unit tests for tick bar visibility behavior on hover and keyboard interaction |
| e2e_playwright/st_slider_test.py | Adds e2e test for slider tick bar visibility with snapshot testing |
| e2e_playwright/st_select_slider_test.py | Adds e2e test for select slider tick bar visibility with snapshot testing |
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.
It is expected that the labels will be cut off in the snapshot since they are positioned outside of the slider boundaries. This also has the small benefit of ensuring that the placement is correct.
| data-testid="stSlider" | ||
| onMouseEnter={() => setIsHovered(true)} | ||
| onMouseLeave={() => setIsHovered(false)} | ||
| style={{ position: "relative" }} |
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.
suggestion: This should be leveraging styled-components.
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.
Updated 👍
| onMouseEnter={() => setIsHovered(true)} | ||
| onMouseLeave={() => setIsHovered(false)} |
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.
suggestion (non-blocking): Stabilize these via useCallback to prevent unnecessary re-renders.
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.
Updated 👍
| expect(tickBar).toBeVisible() | ||
|
|
||
| await user.unhover(sliderContainer) | ||
| expect(tickBar).not.toBeVisible() |
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.
question: Is it possible for these tests to flake due to timing issues?
Looks like opacity has a 70ms transition for opacity on it. If it's possible, then waitFor(() => expect(tickBar).not.toBeVisible()) would be preferred in all of these places that assert visibility state of the Tick Bar
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.
I think it might already work since it's an ease-in animation, so it's already visible in the first ms. But adding a waitFor here doesn't seem to hurt.
Describe your changes
Show the slider tick labels on hover:
Screen.Recording.2025-08-29.at.11.51.31.mov
Closes #12136
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.