forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material/dialog): autofocus should wait for rendering to complete
The current implementation of the dialog's `finishDialogOpen`, which includes autofocus, only waits for a microtask before executing. This only works in the tests because of the synchronous call to `detectChanges` after opening the dialog, ensuring that change detection runs before the microtask. In an application, this is not guaranteed because `NgZone` will only run change detection when the microtask queue empties, which includes the microtask created by the dialog container. This commit updates the implementation to wait for the next render to coplete, _then_ queues a microtask that will finish the open process and perform autofocus.
- Loading branch information
Showing
3 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters