-
Notifications
You must be signed in to change notification settings - Fork 87
fix: defer detect layout mode until updates are done #9889
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: defer detect layout mode until updates are done #9889
Conversation
@@ -524,7 +524,7 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab | |||
*/ | |||
async _finishTransition() { | |||
// Detect new layout mode after DOM has been updated | |||
this.__detectLayoutMode(); | |||
queueMicrotask(() => this.__detectLayoutMode()); |
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.
The delay is a bit concerning, as the promise resolved below triggers the view transition to start, at which point we want the attributes set by __detectLayoutMode
to be present. However the timing seems to work out at the moment in both Chrome and Safari, so I'm fine with it. Might be of interest in case view transitions stop working properly at some point.
|
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.
Let's also cherry pick this to 24.8
* fix: defer detect layout mode until updates are done * chore: add comment on why the calculation is deferred * test: specify litelement in test name
Description
Under some conditions, the dimension updates for the details are not completed when the new layout mode is determined. This PR wraps the call in
queueMicrotask
in order to defer it until all the dimensions are updated.Fixes #8969
Type of change
Checklist