Repository navigation
Stop a clicked legend entry staying highlighted (fix #506) - #507
Open
stephaniehobson wants to merge 1 commit into
Open
stephaniehobson wants to merge 1 commit into
stephaniehobson wants to merge 1 commit into
Conversation
Clicking a legend entry also focuses it, and the focus highlight stayed after the pointer left, so a line shown again kept the others faded. A pointer click now clears the focus highlight; keyboard focus still sets it.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the legend focus-highlight change.
No open issues 🎉
What changed in this PR
Fixes #506 in the dashboard charts by clearing the focus highlight after a mouse click on a legend entry. This prevents other lines from staying faded after the pointer leaves, while preserving keyboard focus highlighting and hover behavior.
Changes:
- Clear legend focus highlighting for clicks with
event.detail > 0. - Add unit and browser regression tests for keyboard behavior and restoring full line opacity.
| File | Description |
|---|---|
tests/playwright/specs/fixtures/chart-series.spec.js |
Verify all lines regain full opacity after a line is re-enabled and the pointer leaves. |
src/tests/jest/Chart.test.jsx |
Check that mouse clicks clear focus highlighting while keyboard clicks retain it. |
src/components/views/Chart.jsx |
Clear focus highlighting on mouse clicks without changing keyboard activation. |
Review effort: Balanced
This branch has not been deployed
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 #506.
Clicking a legend entry also focuses it in Chrome and Firefox. Hover and focus are tracked separately, so after the pointer left, the focus highlight was still there. While the line is hidden that highlight is blocked, but once the line is shown again it applies and the other lines stay faded. Clicking an entry to hide a different line had the same problem.
A click made with the mouse (
event.detail > 0) now clears the focus highlight. A keyboard press (Enter or Space) doesn't, so tabbing to an entry still highlights its line, and hovering works as before.Testing:
npm testpasses (lint, unit, Playwright).