fix: set dialog position on drag start #10191
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Description
On drag start, the dialog currently applies position absolute, left and top styles to the overlay. But it does not update the
leftandtopproperties of the dialog. On drag end it always fires adraggedevent 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 thedraggedevent to update its own properties, which then get synced back to the client asnull. The property change listener triggers and dialog resets the styles on the overlay, except for theposition, which causes the jump reported in #10154.Before #9456 this was working without the jump because the logic in
setBoundscalculated a top / left style ofnullpx, which resulted in keeping the previous style set on drag start.This change "locks" the current position into the
topandleftproperties right on drag start, so that thedraggedevent 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 thedraggedevent in that case, but that seems to be a bigger undertaking.Fixes #10154
Type of change