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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari Scrollbar Media Query #4682

Closed
mariomc opened this issue Jun 16, 2021 · 0 comments
Closed

Safari Scrollbar Media Query #4682

mariomc opened this issue Jun 16, 2021 · 0 comments

Comments

@mariomc
Copy link
Contributor

mariomc commented Jun 16, 2021

  • Swiper Version: v6.7.0 (happens with all, really 馃槄 )
  • Platform/Target and Browser Versions: macOS Safari (14.1.1) but happens with all. Only happens when the page has vertical overflow AND the user has a scrollbar setting on "always visible" or has a mouse connected

What You Did

When in visible scrollbar mode, macOS Safari discounts the width of the scrollbar to the window.innerWidth for its own media queries.
This creates a dissonance between swiper and how media queries are enacted for those devices

https://stackblitz.com/edit/swiper-demo-1-default-c22ogy?file=index.html

Expected Behavior

The logic used by Swiper breakpoint election should mirror the CSS media queries behaviours in all devices

Actual Behavior

To test this out, go to System Preferences > General and either turn the "Always" option ON or have a mouse connected with "Automatic based on mouse or trackpad" (default for macOS)

Screenshot 2021-06-16 at 10 41 51

After that is done use Safari to go to: https://swiper-demo-1-default-c22ogy.stackblitz.io

When in a resolution around 15px (or the width of the scrollbar) of the edge of the breakpoints you can notice the mismatch between an element shown using CSS media queries and the breakpoints used in Swiper.

Screen.Recording.2021-06-16.at.10.50.25.mov

I'll open a PR fixing the issue soon after. 馃槃

@mariomc mariomc changed the title Safari Scrollbar Safari Scrollbar Media Query Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant