Skip to content

(Line keyboard nav) Enhance S2 line features, reference lines, and documentation updates - #870

Open
majornista wants to merge 222 commits into
adobe:dataNavigatorManualfrom
majornista:dataNavigatorManual
Open

(Line keyboard nav) Enhance S2 line features, reference lines, and documentation updates#870
majornista wants to merge 222 commits into
adobe:dataNavigatorManualfrom
majornista:dataNavigatorManual

Conversation

@majornista

@majornista majornista commented Aug 7, 2026

Copy link
Copy Markdown

Description

Adds accessible keyboard navigation ("data-navigator") support for S2 line charts, bringing lines to parity with the existing bar navigation support. Specifically:

  • buildLineStructure.ts — builds the navigator's line/point node structure (series → points), including focus node IDs so keyboard navigation can address individual points and whole lines.
  • segmentId.ts — shared helper for constructing unique navigation node IDs.
  • lineFocusRingUtils.ts — generates the chart-level, line-level, and point-level focus ring marks rendered in the Vega spec when a node is focused via keyboard.
  • focusMatchUtils.ts — shared expression helper (getFocusedGroupOrItemMatchExpr) used to test whether a given datum matches the currently focused dimension/item, reused across the line marks and legend opacity logic.
  • Focus-aware deemphasis — lines and legend entries now dim non-focused series/points (via FADE_FACTOR) when a node is focused through keyboard navigation, mirroring the existing hover-deemphasis behavior.
  • Click-to-focus — clicking a line/point in the Vega chart now updates navigator focus state, so mouse and keyboard interactions stay in sync (Navigator.tsx, dataNavigatorAdapter.ts).
  • Bars are now interactive when accessible navigation is enabled, so they participate in the same click-to-focus wiring as lines.
  • New constants (NAVIGATION_INDEX_FIELD and related) for keying a point's position within its line for keyboard-navigation focus.
  • Storybook coverage added via LineAccessibleNavigation.story.tsx, plus unit tests for all new/modified logic (buildLineStructure, lineFocusRingUtils, focusMatchUtils, lineDataUtils, lineMarkUtils, lineSpecBuilder, legendUtils, dataNavigatorAdapter, buildBarStructure, buildChartStructure).

Related Issue

Motivation and Context

S2 line charts had no keyboard-accessible way to navigate between series and data points — only bars supported the data-navigator. This closes that gap so line charts meet the same accessibility bar, and keeps focus/hover deemphasis visually consistent between mouse and keyboard interaction.

How Has This Been Tested?

  • Added unit tests covering the new line structure builder, focus ring generation, focus-match expression helper, and the updated legend/line opacity and mark-building logic.
  • Ran yarn test scoped to the touched packages (vega-spec-builder-s2/src/{line,legend,marks,bar} and the dataNavigator suite in react-spectrum-charts-s2) — all suites passing.
  • Verified interactively in Storybook via the new LineAccessibleNavigation story (keyboard navigation between lines/points, focus rings rendering, legend/line deemphasis).

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Tanu Garg and others added 30 commits June 2, 2026 14:27
…e to take a number or an array of series names
feat: Reference Line size for S2
c-lamoureux and others added 21 commits August 5, 2026 13:57
Update package version to 1.49.0
Adds /bug-summary command to scan planning/specs/*/issues/*.json (excluding
implemented/) and report brief grouped summaries of open bug specs.
Assigns each open spec a sequential id (sorted by file path) so a follow-up
command can target a specific spec by number instead of its full slug.
Fix: S2 line forecast point label position
fix: add proper opacity highlighting to line point annotation text
…ow flickering when metric range points are out of view
…s into feat/design-feature-tokens-and-skills
…imension-interaction

bug: fix overflow flickering of metric range points that are out of view
…d-skills

feat: design and feature tokens
Implements accessible data-navigator support for S2 line charts, including line/point structure building, focus node IDs, keyboard semantics, and chart/line/point focus rings in Vega marks. It also wires click-to-focus from Vega items back into navigator state, adds focus-aware opacity/deemphasis behavior for lines and legends, makes bars interactive when accessible navigation is enabled, and adds Storybook and test coverage for the new behavior.
@c-lamoureux

Copy link
Copy Markdown
Contributor

This is great! I'll perform a full review by the end of the week so we can get it in. Thanks for taking the time to put it together!

@majornista

Copy link
Copy Markdown
Author

This is great! I'll perform a full review by the end of the week so we can get it in. Thanks for taking the time to put it together!

Note that the huge number of commits and files changed comes from merging main into dataNavigationManual before adding the relevant commit: f1fb680.

@majornista

Copy link
Copy Markdown
Author

I need to work on the behavior with chart tooltips, so that they display and position relative to the focused node, and chart popovers, so that they can be toggled from the data navigator node.

@c-lamoureux

Copy link
Copy Markdown
Contributor

I'm still reviewing. I'd like to see what the feedback from Frank is on #822 as well before we bring this in.

Arrow-key navigation left the hover-look (point emphasis, opacity/
strokeWidth boost, hover label) stuck on whatever node the mouse last
hovered, since keyboard focus never fired the mouseover/mouseout
events those signals depend on. Add an interactionModality signal
that tracks whether pointer or keyboard was used most recently, and
gate every hover-vs-focus check in the Line encodings on it so the
hover-look follows the modality that's actually active — including
restoring focus's hover-look when the pointer leaves the chart, and
fixing the mirror-image bug in the animated hover-ramp path where
focus permanently overrode hover once touched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@c-lamoureux c-lamoureux changed the title Enhance S2 line features, reference lines, and documentation updates (Line keyboard nav) Enhance S2 line features, reference lines, and documentation updates Aug 18, 2026
Michael Jordan added 3 commits August 20, 2026 18:32
Wires up the data-navigator keyboard navigation (accessibleNavigation) to open ChartPopover on Enter/Space and drive ChartInspect tooltips via keyboard focus for both Line and Bar marks.

Key changes:
- Extract `selectAndOpenPopover` from `handleMarkClick` so it can be called from the keyboard path too
- Add `focusedItemGeometry.ts` to compute scale-projected bounds/position for a keyboard-focused datum (no real Vega Item available)
- Refactor `attachDataNavigator` to return a handle (`destroy`, `refocusCurrent`, `attachViewListeners`) instead of a bare cleanup function
- Fix nav-structure teardown on re-render by using stable callback refs for `onActivate`, `onLeafFocus`, `getPopoverInfo`, and `getHoverClearInfo`
- Suppress a fast double-Escape right after a popover closes (grace window)
- First Escape dismisses a visible ChartInspect tooltip; second Escape drills out
- Restore keyboard focus to the navigator node after the popover closes (double-rAF)
- Add `mouseleave`/`mouseover` handlers so moving to a legend item restores the focused line's opacity
- Track blur/focus to clear visual signals when tabbing out but preserve the node for shift+Tab back
- Extract `getChartFocusRing` into a shared `chartFocusRingUtils.ts` (was duplicated in bar and line)
- Replace the per-row Vega `window` transform for nav indices with a JS-precomputed signal (`navIndexByMarkId`) to avoid silently reordering the table
- Update docs for bar.md, line.md, and overview.md with accessible navigation sections and key bindings
When accessibleNavigation is enabled on a Bar with no other interactive features, the interactionModality signal was never added to the spec. applyFocusSignals in dataNavigatorAdapter.ts writes to this signal unconditionally on keyboard focus, causing a Vega runtime error and breaking keyboard navigation entirely. Fix adds the signal whenever accessibleNavigation is true, with regression tests and an integration test covering full keyboard drill-down behavior.
Centralized chart-wide accessible-navigation primitives in S2 (`addFocusSignals`, `addChartFocusRing`) and reused them across chart, bar, and line builders so multi-mark charts no longer emit duplicate focus signals or duplicate `chartFocusRing` marks. Also fixed keyboard nav integration by resolving default mark names in `RscChart` (so Enter opens popovers even without explicit mark names), gated Escape tooltip dismissal to `accessibleNavigation`, extracted shared node label semantics utilities with tests, and updated Line accessible-navigation docs/stories to match the revised arrow-key behavior.
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.

6 participants