Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

yjbanov
Copy link
Contributor

@yjbanov yjbanov commented Jul 2, 2024

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 using SemanticsAction.focus. This is because on the web, a11y focus is not observable, only input focus is. Sending SemanticsAction.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

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jul 2, 2024
@yjbanov yjbanov marked this pull request as draft July 2, 2024 17:10
@flutter-dashboard
Copy link

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.

@yjbanov yjbanov marked this pull request as ready for review July 2, 2024 17:14
@yjbanov yjbanov force-pushed the send-semantics-action-focus-3 branch from eccf797 to f3b8f0f Compare July 9, 2024 20:09
@yjbanov yjbanov force-pushed the send-semantics-action-focus-3 branch from f10597f to a887f2b Compare July 12, 2024 23:58
@chunhtai chunhtai self-requested a review July 15, 2024 16:12
Copy link
Contributor

@chunhtai chunhtai left a 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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@yjbanov yjbanov added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 15, 2024
@auto-submit auto-submit bot merged commit f008c51 into flutter:main Jul 15, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 15, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 15, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 15, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 15, 2024
…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
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
2 participants