Skip to content
Source
Sign inSign up
TanStack/charts

feat(interaction): tell brushX format which handle it labels #172

Closedandersk(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/172/headopened

A brushX format callback produces each keyboard handle's aria-valuetext, but it only received the value. When the values mark boundaries between items, such as the edges between bars in an overview chart, the same boundary means "from the next item" for the start handle and "through the previous item" for the end handle, so one of the two handles always announced the wrong item.

Pass a BrushXFormatContext naming the start or end handle as the second argument, following the value-plus-context convention of other formatters. Existing one-argument formatters are unaffected.

Summary by CodeRabbit

  • New Features
    • Brush value formatters can now distinguish the start and end handles, enabling more specific accessible labels for each boundary.
  • Documentation
    • Clarified how to use the formatter context to label values at the brush boundaries.
    1. 🦋 Changeset detected

      Latest commit: 2ca53e4228763289781ece69ee3c3eb5d83de885

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 12 packages
      NameType
      @tanstack/chartsMinor
      @tanstack/alpine-chartsMinor
      @tanstack/angular-chartsMinor
      @tanstack/lit-chartsMinor
      @tanstack/octane-chartsMinor
      @tanstack/preact-chartsMinor
      @tanstack/react-chartsMinor
      @tanstack/react-native-chartsMinor
      @tanstack/solid-chartsMinor
      @tanstack/svelte-chartsMinor
      @tanstack/vue-chartsMinor
      @tanstack/charts-scalesMinor

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 9012251e-40fb-45bc-99d9-c256425ac2eb
      📥 Commits

      Reviewing files that changed from the base of the PR and between e6a51a836e0bf9ea5288822a4247a995f43a768c and 2ca53e4228763289781ece69ee3c3eb5d83de885.

      📒 Files selected for processing (7)
      • .changeset/brush-x-format-handle.md
      • docs/reference/focus-and-interaction.md
      • docs/reference/types.md
      • packages/charts-core/docs/reference/focus-and-interaction.md
      • packages/charts-core/docs/reference/types.md
      • packages/charts-core/src/interaction-brush.test.ts
      • packages/charts-core/src/interaction-brush.ts

      Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.


      📝 Walkthrough

      Walkthrough

      brushX formatting now receives context identifying the start or end handle. The handle’s formatted text is used for its aria-valuetext. Tests and reference documentation cover the context and handle-specific labels.

      Changes

      BrushX handle formatting

      Layer / File(s)Summary
      Handle context and accessibility text
      packages/charts-core/src/interaction-brush.ts, packages/charts-core/src/interaction-brush.test.ts, packages/charts-core/docs/reference/focus-and-interaction.md, packages/charts-core/docs/reference/types.md, docs/reference/focus-and-interaction.md, docs/reference/types.md, .changeset/brush-x-format-handle.md
      BrushXFormatContext identifies the start or end handle. decorateHandle passes that context to format when setting aria-valuetext. A test checks both handle labels. The reference documentation and changeset describe the context.

      Priority: ⬇️ Low

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Feature

      Suggested reviewers: tannerlinsley

      Merge Risk: ⚪ Minimal · up to 2ca53

      The change lets brush formatters provide handle-specific accessibility text. No concrete merge-blocking issue was found; proceed with normal checks.

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (5 skipped: 5 …Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title clearly summarizes the main change: brushX format callbacks receive the handle they label.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (5 skipped: 5 unsupported.)

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. Thanks @andersk, the start/end formatter context is included in #184 and released in 1.1.0. Existing one-argument formatters remain supported. Closing this PR as incorporated into the release batch.

    4. tannerlinsley closed this

Sign in to join this conversation.