[web] do not send SemanticsAction.focus inside frame#162554
[web] do not send SemanticsAction.focus inside frame#162554yjbanov merged 3 commits intoflutter:masterfrom
Conversation
| /// | ||
| /// Used for debugging only. | ||
| int debugFrameNumber = 1; | ||
| // TODO(yjbanov): this file should be deleted as part of https://github.com/flutter/flutter/issues/145954 |
There was a problem hiding this comment.
Nice catch! I think it's better if we moved the file so that it gets deleted with the html code: #162608
| /// implementation. | ||
| /// | ||
| /// This is intended for tests only. | ||
| static void debugOverrideFrameService(FrameService? mock) { |
There was a problem hiding this comment.
| static void debugOverrideFrameService(FrameService? mock) { | |
| @visibleForTesting | |
| static void debugOverrideFrameService(FrameService? mock) { |
| /// DOM event handlers whose notifications to the framework result in state | ||
| /// changes may want to delay their notifications, e.g. by scheduling them in | ||
| /// a timer. | ||
| bool get isUpdatingSemanticsTree => _isUpdatingSemanticsTree; |
There was a problem hiding this comment.
I'm guessing this is leftover from a previous iteration? It's not being used anywhere.
There was a problem hiding this comment.
Yep! Thanks for catching. Cleaning up.
49bf60b to
06e4f2c
Compare
|
autosubmit label was removed for flutter/flutter/162554, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
|
autosubmit label was removed for flutter/flutter/162554, because - The status or check suite Mac tool_integration_tests_1_5 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Fix the issue with the first frame not rendering, introduced in #162554. Nobody filed an issue yet. I found it while testing something else.
When a
SemanticsActionfires while rendering a frame, delay it by a zero-length timer.Explanation
A concrete situation where this happens is when a semantics update causes DOM focus shift. DOM focus events are delivered synchronously when induced programmatically. We want to notify the framework about the shift. Since it wasn't the framework that decided where the focus moved, the framework may end up out-of-sync with the engine about which widget is currently focused. However, if the framework is still in the middle of rendering a frame, the notification may induce an illegal
setState. We have to wait until the framework is done before delivering the notification.How
FrameServiceand consolidate all frame scheduling logic into it (this also makes it way more testable).FrameService.isRenderingFrameboolean that can be used to tell if a frame is being rendered.invokeOnSemanticsActionto useisRenderingFrameto decide if the action can be delivered immediately, or delayed by a zero-length timer.Fixes #162472