KEMBAR78
fix: set dialog position on drag start by sissbruecker · Pull Request #10191 · vaadin/web-components · GitHub
Skip to content

Conversation

@sissbruecker
Copy link
Contributor

Description

On drag start, the dialog currently applies position absolute, left and top styles to the overlay. But it does not update the left and top properties of the dialog. On drag end it always fires a dragged event with the coordinates from those properties. However, if you never move the dialog, then the properties will still be undefined and so will the coordinates in the event. That causes an issue for the Flow component which listens for the dragged event to update its own properties, which then get synced back to the client as null. The property change listener triggers and dialog resets the styles on the overlay, except for the position, which causes the jump reported in #10154.

Before #9456 this was working without the jump because the logic in setBounds calculated a top / left style of nullpx, which resulted in keeping the previous style set on drag start.

This change "locks" the current position into the top and left properties right on drag start, so that the dragged event reports correct coordinates even if the dialog is not moved. Given that previously the position / top / left style was already kept on the overlay even without moving it this seems fine. An even better approach would probably be to not fire the dragged event in that case, but that seems to be a bigger undertaking.

Fixes #10154

Type of change

  • Bugfix

@sonarqubecloud
Copy link

@sissbruecker
Copy link
Contributor Author

It looks like setBounds was moved in v25 so this needs to be picked manually.

@web-padawan web-padawan merged commit 91cca28 into main Sep 19, 2025
9 checks passed
@web-padawan web-padawan deleted the fix/dialog-drag-position-reset branch September 19, 2025 08:36
sissbruecker added a commit that referenced this pull request Sep 22, 2025
* fix: set dialog position on drag start (#10191)

* fix: align setting bounds with v25, remove not needed tests

---------

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
Co-authored-by: web-padawan <iamkulykov@gmail.com>
sissbruecker added a commit that referenced this pull request Sep 22, 2025
* fix: set dialog position on drag start (#10191)

* fix: align setting bounds with v25, remove not needed tests

---------

Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
Co-authored-by: web-padawan <iamkulykov@gmail.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 25.0.0-alpha12.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dialog moves down on click

3 participants