-
Notifications
You must be signed in to change notification settings - Fork 83
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
fix: update position on visual viewport scroll and resize #7279
fix: update position on visual viewport scroll and resize #7279
Conversation
Quality Gate passedIssues Measures |
This snippet can be used for testing the fix (for example, on iOS simulator): <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Combo box</title>
</head>
<body>
<vaadin-combo-box></vaadin-combo-box>
<div style="height: 350px"></div>
<vaadin-combo-box></vaadin-combo-box>
<div style="height: 500px"></div>
<script type="module">
import '@vaadin/combo-box';
document.querySelectorAll('vaadin-combo-box').forEach((comboBox) => {
comboBox.items = ['Item 1', 'Item 2', 'Item 3'];
});
</script>
</body>
</html> |
There is now a question whether we still need to call web-components/packages/overlay/src/vaadin-overlay-position-mixin.js Lines 199 to 200 in 5d30427
I'm leaning toward keeping it since it might also cover template rendering for someone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that the fix works (the overlay is positioned correctly after a short delay).
Before
combo-bug.mp4
After
combo-after.mp4
) Co-authored-by: Sergey Vinogradov <[email protected]>
Description
The PR adds listeners for visual viewport scroll and resize events to update the overlay's position accordingly. Based on my testing, the visual viewport events are triggered in all scenarios in which the corresponding window events are triggered, so I completely replaced the window scroll and resize listeners with the visual viewport ones.
The Visual Viewport API has good support across all browsers supported by Vaadin 24:
Fixes #7214
Type of change