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

Added .viewport modifier to x-on directive to add listeners to window.visualViewport instead #4350

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

signorekai
Copy link

Problem

On iOS Safari (v17.3), resize events on window does not fire immediately to viewport resizes (caused by browser chrome hiding address bars). However, it does fire almost immediately when binded to window.visualViewport.

Solution

Added .viewport modifier to x-on directive to add listeners to window.visualViewport

@SimoTod
Copy link
Collaborator

SimoTod commented Aug 23, 2024

Does the resize plugin (x-resize) have the same issue?

@signorekai
Copy link
Author

signorekai commented Aug 23, 2024

Yes it does.

Screenshot 2024-08-23 at 4 56 38 PM
(from iOS inspector)

As the user scrolls and the browser starts to hide the address bar, the resize event for window.visualViewport gets called almost immediately while the x-resize only gets called at the end of the scroll (after easing).

@ekwoka
Copy link
Contributor

ekwoka commented Aug 24, 2024

Interesting.

Could this be an issue where the listener should be passive or you risk causing issues?

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

Successfully merging this pull request may close these issues.

3 participants