Skip to content
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

Flutter views can gain focus #54985

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

tugorez
Copy link
Contributor

@tugorez tugorez commented Sep 5, 2024

I am unsure why the tabindex was removed when semantics were enabled. It seems this change was made without a clear explanation (by me). This PR shouldn't cause any issues as Flutter Views already have a tabindex, we're not adding a new one. This change is necessary because the semantics text strategy refocuses the view on deactivation, requiring the Flutter view to be focusable.

ThIs PR is a requirement to enable #54966.

flutter/flutter#153022

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Sep 5, 2024
@tugorez tugorez marked this pull request as ready for review September 6, 2024 04:20
Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR seems correct. What it does is to make the current flutter view focusable (so it can retain the focus if needed), but inaccessible by keyboard. See tabindex docs.

@ditman
Copy link
Member

ditman commented Nov 5, 2024

The only change I want to make is to rename the method a little bit, because all it seems to be doing is to modify the keyboard reachability of the view, but the name is more generic than what it actually does.

@ditman
Copy link
Member

ditman commented Nov 6, 2024

I'm taking a quick stab at attaching the focus handlers to the flutter view root, rather than the body.

@ditman
Copy link
Member

ditman commented Nov 12, 2024

@@ -68,28 +68,6 @@ void testMain() {
expect(view2.dom.rootElement.getAttribute('tabindex'), '0');
});

test('never marks the views as focusable with semantincs enabled', () async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add some tests? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there's tests already (this file is just showing the removed test, but there's others to verify the rest of the functionality!)

@ditman ditman requested a review from yjbanov November 13, 2024 21:59
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ditman ditman added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 14, 2024
@ditman
Copy link
Member

ditman commented Nov 14, 2024

One last update and applying autosubmit.

Copy link
Contributor

auto-submit bot commented Nov 14, 2024

auto label is removed for flutter/engine/54985, due to - The status or check suite Linux mac_android_aot_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants