Skip to content

fix(aria): restore generated label attributes when disabled - #21804

Open
WhyTan00 wants to merge 1 commit into
apache:masterfrom
WhyTan00:fix-21803
Open

WhyTan00 wants to merge 1 commit into
apache:masterfrom
WhyTan00:fix-21803

Conversation

@WhyTan00

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Restore the chart host's original ARIA attributes when generated labels are disabled, while preserving attributes changed by the application.

Fixed issues

Fixes #21803.

Details

Before: What was the problem?

After generating a label, aria.enabled: false, aria.label.enabled: false, or setOption({}, { notMerge: true }) leaves the generated role="img" and stale aria-label on the chart host.

After: How does it behave after the fixing?

Track the original and last generated values on the host DOM element. On disable, restore or remove only attributes whose values still match the generated values. Keeping this state on the DOM also handles notMerge; application changes are preserved independently for each attribute. Re-enabling produces the current label again.

The existing ARIA unit file now covers all three disable paths, automatic descriptions, pre-existing host attributes, application overrides, repeated updates, and re-enabling.

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

  • npm test -- --runInBand --runTestsByPath test/ut/spec/series/aria-columns-exclude.test.ts --coverage=false: 12 passed; before the fix, 8 failed and 4 passed.
  • npm test -- --runInBand: all 26 suites / 204 tests passed with the default coverage setting.
  • npx eslint src/visual/aria.ts and npm run checkheader: passed.
  • Full npm run lint: the same 6 pre-existing BMap diagnostics on unchanged HEAD and this patch.
  • npm run checktype: blocked by 1,364 parser diagnostics in the installed @types/node declarations under the repository's TypeScript 4.4.3; diagnostics are identical on unchanged HEAD and this patch. No dependency changes are included. Supplemental source checks excluding ambient types produce the same existing 23 browser-source and 30 BMap diagnostics on base and patch, with no new ARIA diagnostic; these are not claimed as passing typechecks.

Merging options

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

Other information

Implementation and regression tests were prepared with AI assistance and verified locally. No generated bundles are included.

@echarts-bot

echarts-bot Bot commented Oct 23, 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.

This branch has not been deployed

No deployments
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] Generated ARIA label and role remain after disabling ARIA

1 participant