Skip to content

Stop a clicked legend entry staying highlighted (fix #506) - #507

Open
stephaniehobson wants to merge 1 commit into
mainfrom
fix-506-legend-focus-highlight
Open

stephaniehobson wants to merge 1 commit into
mainfrom
fix-506-legend-focus-highlight

Conversation

@stephaniehobson

Copy link
Copy Markdown
Collaborator

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:

  • New unit test: a mouse click clears the focus highlight and a keyboard press keeps it.
  • New Playwright test: show a line again by clicking, move the pointer away, and check no line stays faded. It fails without the fix.
  • npm test passes (lint, unit, Playwright).

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: After re-enabling a line display the hover effect doesn't un-hover.

2 participants