Skip to content

fix(aria): preserve literal dollar sequences in label text - #21787

Merged
plainheart merged 1 commit into
apache:releasefrom
Panoramasx:fix-21786
Oct 13, 2026
Merged

plainheart merged 1 commit into
apache:releasefrom
Panoramasx:fix-21786

Conversation

@Panoramasx

@Panoramasx Panoramasx commented Oct 12, 2026 •

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Preserves literal dollar sequences in chart titles, series names, and data item names when generating ARIA descriptions.

Fixed issues

Closes #21786.

Details

Before: What was the problem?

With ARIA enabled, a chart titled Revenue $& receives an aria-label containing Revenue {title}. Similarly, $$ becomes a single dollar sign, and a dollar sign followed by a backtick or single quote inserts surrounding template text.

The same problem affects series names and data item names. The visible text and the accessibility description therefore disagree.

After: How does it behave after the fixing?

The existing template helper now supplies a callback returning the value to String.prototype.replace. Values are inserted literally, while existing placeholder matching and global replacement behavior are retained. There are no public API or type changes.

For example, Revenue $& and Revenue $$ remain unchanged in the generated description.

Document Info

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

test/ut/spec/series/aria-label.test.ts exercises actual chart descriptions in EN and ZH locales, all four special replacement sequences, ordinary text, repeated and whitespace-padded placeholders, and numeric values including zero.

Merging options

  • Please squash the commits into a single one when merging.

Other information

Validation:

  • Before the fix: 9 regression failures and 2 ordinary-text passes.
  • After the fix: all 11 new tests pass.
  • After rebasing onto release: npm test -- --runInBand passes all 33 suites and 226 tests; npm run checktype, ESLint on both changed files, and git diff --check also pass.
  • npm run build:lib and npm run checktype: pass.
  • ESLint on both changed files and git diff --check: pass.
  • Full npm run lint reports 6 existing errors in extension-src/bmap/BMapCoordSys.ts. Running it with the original ARIA source restored produces the same errors; this PR does not change that extension.

Tested on macOS with Node.js 22.23.3. No generated build files or dependency changes are included.

Rebased onto release for v6.1.1 as requested in review.

@echarts-bot

echarts-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

@plainheart plainheart left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, thanks for your contribution! This fix looks good to me and it can be a supplement of #21751 fix(format): preserve literal replacement characters in values - I don't know why this PR is showing as a 404 error somehow. 🤔

Commit: e32cec4

Can you rebase your PR onto the release branch and change the target branch to it? It will be included in the upcoming v6.1.1.

Comment thread src/visual/aria.ts Outdated
@plainheart plainheart added this to the 6.1.1 milestone Oct 12, 2026
@plainheart
plainheart merged commit 8ca03d4 into apache:release Oct 13, 2026
2 checks passed
@echarts-bot

echarts-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Dollar replacement sequences corrupt generated aria-label text

2 participants