Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessibility warning in setTimeout breaks tests #17236

Closed
jnizet opened this issue May 2, 2022 · 3 comments · Fixed by #17248
Closed

accessibility warning in setTimeout breaks tests #17236

jnizet opened this issue May 2, 2022 · 3 comments · Fixed by #17248
Labels
a11y Accessibility related. Type: Undecided

Comments

@jnizet
Copy link

jnizet commented May 2, 2022

Version 10.1.0 introduced an error message in case the accessibility module is not loaded. See the change here: https://github.com/highcharts/highcharts-dist/blob/master/es-modules/Core/Chart/Chart.js#L1953-L1966

Unfortunately, it does that in a setTimeout, and there is no way to disable this setTimeout, even by disabling accessibility or adding the accessibility module, because the checks are done in the setTimeout callback itself. So, this setTimeout is always executed, no matter what.
It might not seem like a big deal, but we have tests (in an Angular application), using a "fakeAsync" zone where tests fail shen a timer is still in the queue. And this timeout does that: it introduces a new, unexpected timer, in the queue.

Product version

Highcharts 10.1.0

Affected browser(s)

All

@raf18seb raf18seb added the a11y Accessibility related. label May 2, 2022
@oysteinmoseng
Copy link
Member

Hi @jnizet, interesting use case.

A workaround could be to override the warning function before creating the charts in the tests: Highcharts.Chart.prototype.warnIfA11yModuleNotLoaded = () => {}; Live demo.

We will also look into if there is a robust way to handle this on our end without using timers.

@jnizet
Copy link
Author

jnizet commented May 2, 2022

Hi @oysteinmoseng. Thanks. That's exactly the workaround we used. But it's a dirty hack, especially with TypeScript which doesn't know about the warnIfA11yModuleNotLoaded property.
Thanks for investigating a cleaner way.

@jnizet
Copy link
Author

jnizet commented May 6, 2022

Thanks for the fix @TorsteinHonsi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Accessibility related. Type: Undecided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants