-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] switch to SemanticsAction.focus (attempt 3) #53689
[web] switch to SemanticsAction.focus (attempt 3) #53689
Conversation
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. |
eccf797
to
f3b8f0f
Compare
f10597f
to
a887f2b
Compare
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.
LGTM, just a question.
@@ -164,6 +189,7 @@ class AccessibilityFocusManager { | |||
} | |||
|
|||
target.element.removeEventListener('focus', target.domFocusListener); | |||
target.element.removeEventListener('blur', target.domBlurListener); |
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.
is it possible to tell the difference between framework request focus and user interacting dom focus by the Event object in the listener?
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.
I'm not aware of one for focus/blur events specifically. The closest thing available is the isTrusted property, but it only detects dispatchEvent
, which is not enough. Clicks can be differentiated by looking at their screenX/Y
properties (source), but focus/blur doesn't have coordinates.
…151783) flutter/engine@8440bbe...cd78d21 2024-07-15 skia-flutter-autoroll@skia.org Roll Skia from 559a46957250 to 476abcbc2e4d (4 revisions) (flutter/engine#53911) 2024-07-15 skia-flutter-autoroll@skia.org Roll Skia from fe05596a26ea to 559a46957250 (7 revisions) (flutter/engine#53909) 2024-07-15 yjbanov@google.com [web] switch to SemanticsAction.focus (attempt 3) (flutter/engine#53689) 2024-07-15 skia-flutter-autoroll@skia.org Roll Skia from a3c29413cdf0 to fe05596a26ea (1 revision) (flutter/engine#53907) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC bdero@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#151783) flutter/engine@8440bbe...cd78d21 2024-07-15 skia-flutter-autoroll@skia.org Roll Skia from 559a46957250 to 476abcbc2e4d (4 revisions) (flutter/engine#53911) 2024-07-15 skia-flutter-autoroll@skia.org Roll Skia from fe05596a26ea to 559a46957250 (7 revisions) (flutter/engine#53909) 2024-07-15 yjbanov@google.com [web] switch to SemanticsAction.focus (attempt 3) (flutter/engine#53689) 2024-07-15 skia-flutter-autoroll@skia.org Roll Skia from a3c29413cdf0 to fe05596a26ea (1 revision) (flutter/engine#53907) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC bdero@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This relands #53679.
The difference from the previous attempt is in the last commit, which prevents synthetic focus requests from echoing back into the framework. That part broke too many tests in g3 and needs to be revisited.
Original description
Stop using
SemanticsAction.didGain/LoseAccessibilityFocus
on the web, start usingSemanticsAction.focus
. This is because on the web, a11y focus is not observable, only input focus is. SendingSemanticsAction.focus
will guarantee that the framework move focus to the respective widget. There currently is no "unfocus" signal, because it seems to be already covered: either another widget gains focus, or an HTML DOM element outside the Flutter view does, both of which have their respective signals already.More details in the discussion in the issue flutter/flutter#83809.
Fixes flutter/flutter#83809
Fixes flutter/flutter#148285
Fixes flutter/flutter#143337