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

Wrong numbers in Safari 14 #290

Open
jaimeiniesta opened this issue Jul 15, 2021 · 5 comments
Open

Wrong numbers in Safari 14 #290

jaimeiniesta opened this issue Jul 15, 2021 · 5 comments

Comments

@jaimeiniesta
Copy link

Hello!

We just found a bug that only seems to happen in Safari (I'm on Safari 14 and macOS Big Sur).

When the font size is changed using Cmd - or Cmd +, the number value gets displaced showing an offset, also the bar is not properly adjusted.

Here's a video I made showing this in action, check out the black circle that should go from 0 to 100, it goes to negative numbers when the font is decreased:

Progressbar-bug.mp4

This is not happening in Chrome, Firefox or Opera. Only in Safari.

@bibekrimal
Copy link

I have the same issue. The value decreases if page is zoomed out and it increases in zoomed in.

@dannycalliari
Copy link

I'm having the same issue. This bug should be resolved quickly. We are thinking about changing to a different one because of this bug

@mmjr-x
Copy link

mmjr-x commented Sep 21, 2022

I also encountered this issue, it has to do with zoom level affecting stroke-dashoffset on safari.

I came up with this dirty fix in order to resolve the issue:

import * as ProgressBar from "progressbar.js";

if (navigator.vendor === 'Apple Computer, Inc.') {

  const scale = window.outerWidth  / window.innerWidth;

  ProgressBar.Path.prototype._getComputedDashOffset = function _getComputedDashOffset() {
    var computedStyle = window.getComputedStyle(this.path, null);

    return parseFloat(computedStyle.getPropertyValue('stroke-dashoffset')) * scale;
  };

}

I am using typescript in my project so you might need to adjust this to your needs.
Also this should be imported/loaded after you import * as ProgressBar from "progressbar.js"; and before you do any of the progressbar setup (else you might get weird results).

@mmjr-x
Copy link

mmjr-x commented Sep 21, 2022

@kimmobrunfeldt Let me know if you find this solution acceptable. If so I will be happy to make a PR for this :)

@kimmobrunfeldt
Copy link
Owner

This seems like a browser bug so vendor detection is OK for me, I can merge a fix if there's a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants