-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(form-field): incorrect assumptions about page direction #17395
Conversation
These changes undo the changes from angular#15415 because they were making incorrect assumptions about the page starting off as LTR, and they were calling `updateOutlineGap` with an outdated value for the direction. This is causing issues like angular#17390. I'm not totally sure what was being fixed by these changes, because the test that was added didn't fail even if I reverted all of the changes. From what I can tell the problem angular#15415 was trying to solve was that the outline gap might be updated too early on a direction change, before the browser has had the chance to recalculate the layout. These changes switch to recalculating inside a `requestAnimationFrame` after direction changes, in order to give the browser enough time to recalculate the layout. Fixes angular#17390.
0221ca5
to
f759ca1
Compare
this.updateOutlineGap(); | ||
this._previousDirection = this._dir.value; | ||
if (typeof requestAnimationFrame === 'function') { | ||
this._ngZone.runOutsideAngular(() => { |
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.
Shouldn't this whole if-else
be wrapped in runOutsideAngular
? Currently it looks like it runs in the zone if the browser doesn't support requestAnimationFrame
and outside if it does
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.
updateOutlineGap
doesn't do any zone-ey things, we only need to run requestAnimationFrame
on the outside because it can trigger change detection otherwise.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
These changes undo the changes from #15415 because they were making incorrect assumptions about the page starting off as LTR, and they were calling
updateOutlineGap
with an outdated value for the direction. This is causing issues like #17390.I'm not totally sure what was being fixed by these changes, because the test that was added didn't fail even if I reverted all of the changes. From what I can tell the problem #15415 was trying to solve was that the outline gap might be updated too early on a direction change, before the browser has had the chance to recalculate the layout. These changes switch to recalculating inside a
requestAnimationFrame
after direction changes, in order to give the browser enough time to recalculate.Fixes #17390.