Skip to content

fix(charts): dismiss HorizontalBarChart callout on keyboard blur - #36488

Draft
AKnassa wants to merge 1 commit into
microsoft:masterfrom
AKnassa:ak-issue-29925-hbc-tooltip-blur
Draft

fix(charts): dismiss HorizontalBarChart callout on keyboard blur#36488
AKnassa wants to merge 1 commit into
microsoft:masterfrom
AKnassa:ak-issue-29925-hbc-tooltip-blur

Conversation

@AKnassa

@AKnassa AKnassa commented Aug 1, 2026

Copy link
Copy Markdown

Previous Behavior

HorizontalBarChart's tooltip never closed for keyboard users. Tabbing off the chart — or from one chart into a second one — left the first tooltip stuck open. The blur handler had been intentionally emptied years ago to fix a mouse flicker, and keyboard dismissal was never restored. The newer v9 chart carried the same empty handler with a literal "ToDo: fix" comment.

New Behavior

Moving keyboard focus out of the chart closes its tooltip, in both the v8 (react-charting) and v9 (react-charts) packages. Moving focus between bars inside the same chart — or into the tooltip itself — does not dismiss it, so the old flicker problem cannot come back. A maintainer had explicitly welcomed this contribution in the issue.

What changed

  • The blur handler now dismisses the tooltip unless focus stays inside the chart (or its tooltip overlay), in both packages.
  • Red-first tests reproduce the exact scenario from the issue (two charts, tab from one to the other) plus guard tests locking the flicker protection — the guards pass before and after the change.
  • Release-notes change files for both packages.

Full v8 suite green (962 tests); full v9 suite matches its baseline exactly (the only failures are 6 HeatMap snapshots that already fail on untouched master). The v8 VerticalBarChart has a sibling empty handler — flagged as a follow-up.

Related Issue(s)

HorizontalBarChart's _hoverOff was emptied by the callout-flicker
fix in PR microsoft#21750 but stayed wired to onBlur, so the callout only
closed via mouse leave. Keyboard users tabbing out of a chart (or
into a second chart) left the previous callout stuck open. The v9
port carried the same no-op with a ToDo comment.

Revive blur dismissal in both packages, guarded by relatedTarget:
focus moving within the chart root (or into the v8 Layer-portaled
callout, looked up by callout id) does not dismiss, which keeps the
PR microsoft#21750 flicker fix intact - locked in by guard tests that pass
before and after the change.

v8: full react-charting suite green (962 passed). v9: full
react-charts suite matches baseline exactly (only the 6 pre-existing
HeatMapChart snapshot failures remain). v8 VerticalBarChart has a
sibling no-op _onBarLeave - follow-up candidate.

Fixes microsoft#29925
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]: Tooltip for HorizontalBarCharts cannot automatically close

1 participant