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

[Bug]: Using responsive options fails on some browsers #1390

Open
1 task
s-szabo opened this issue Nov 26, 2022 · 0 comments
Open
1 task

[Bug]: Using responsive options fails on some browsers #1390

s-szabo opened this issue Nov 26, 2022 · 0 comments
Labels

Comments

@s-szabo
Copy link

s-szabo commented Nov 26, 2022

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

For specified media types the responsiveOptions (4th option of a chart function e.g. LineChart(..., ..., ..., responsiveOptions)) can be set. In case of some browsers (e.g. Safari 13.1.2 on macOS High Sierra 10.13.6) when you use the responsive Options chartist stops with error. The root cause of the error is the matchMedia function, because in case of some browsers the result object of the matchMedia has only an addListener function instead of the addEventListener function.

Reproduction

Use responsiveOption with e.g. a LineChart in Safari 13.1.2 with macOS High Sierra 10.13.6

Chartist version

v1.3.0

Possible solution

Change the mql.addEventListener("change", updateCurrentOptions); row in the } else if (responsiveOptions) {...} block of chartist to

if (mql.addEventListener) {
    mql.addEventListener("change", updateCurrentOptions);
} else {
    mql.addListener(updateCurrentOptions);
}

This can be found in the row # 1440 of the index.js of npm package of chartist.

@s-szabo s-szabo added the bug label Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant