WhyTan00 opened a new pull request, #21804:
URL: https://github.com/apache/echarts/pull/21804
## Brief Information
This pull request is in the type of:
- [x] 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
- [x] 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
- [x] 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]