Repository navigation
fix(aria): preserve literal dollar sequences in label text - #21787
Conversation
|
Thanks for your contribution! 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. |
There was a problem hiding this comment.
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.
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
Brief Information
This pull request is in the type of:
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 anaria-labelcontainingRevenue {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 $&andRevenue $$remain unchanged in the generated description.Document Info
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
test/ut/spec/series/aria-label.test.tsexercises 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
Other information
Validation:
release:npm test -- --runInBandpasses all 33 suites and 226 tests;npm run checktype, ESLint on both changed files, andgit diff --checkalso pass.npm run build:libandnpm run checktype: pass.git diff --check: pass.npm run lintreports 6 existing errors inextension-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
releasefor v6.1.1 as requested in review.