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

[ios] Fix text input edit rotor accessibility #54351

Merged

Conversation

hellohuanlin
Copy link
Contributor

@hellohuanlin hellohuanlin commented Aug 5, 2024

Fixes text input edit rotor accessibility missing edit actions.

It also fixes a few edit items that is displayed where it's not supposed to. (e.g. displaying select item while nothing to select).

List which issues are fixed by this PR. You must list at least one issue.

Fixes flutter/flutter#151029

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

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.

@hellohuanlin hellohuanlin force-pushed the text_input_edit_rotor_accessibility branch from c9409e9 to 05f72a9 Compare August 5, 2024 19:59
@hellohuanlin
Copy link
Contributor Author

Verified Select and Select All options will only be available when the text field is not empty.

@hellohuanlin
Copy link
Contributor Author

hellohuanlin commented Aug 8, 2024

Verified still need double tap gesture to reveal the edit options with this change, but it seems to be also true for native text field. I will check our behavior before this change to see if it's a regression.

@hellohuanlin hellohuanlin force-pushed the text_input_edit_rotor_accessibility branch from 05f72a9 to c48c830 Compare August 16, 2024 20:50
@hellohuanlin
Copy link
Contributor Author

After reverting #52333, I was able to confirm that it's been an existing behavior to require to double tap to bring up this rotor. So it's not a regression.

@hellohuanlin hellohuanlin changed the title [Draft][ios] Fix text input edit rotor accessibility [ios] Fix text input edit rotor accessibility Aug 19, 2024
@hellohuanlin hellohuanlin force-pushed the text_input_edit_rotor_accessibility branch from c48c830 to 239b294 Compare August 19, 2024 17:04
@hellohuanlin hellohuanlin marked this pull request as ready for review August 19, 2024 17:07
@hellohuanlin hellohuanlin requested a review from chunhtai August 19, 2024 17:07
@@ -462,4 +462,34 @@ - (BOOL)hasText {
return [[self textInputSurrogate] hasText];
}

#pragma mark - UIResponder overrides

- (void)cut:(id)sender {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure all the gotchas, but can this class use forwardingTargetForSelector instead of directly calling every method on textInputSurrogate? It's inevitable we will miss some as they are added in future SDKs. I'm not sure it's the right behavior for this class, though, and I'm not sure if the super class UIAccessibilityElement already implements, in which case it won't work...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out that iOS determines whether to show these options in accessibility rotor by checking the presence of these functions, So we can't use forwardingTargetForSelector.

@hellohuanlin
Copy link
Contributor Author

Not related to objc message forwarding, but found a very interesting crash on select. Looking into it!

@hellohuanlin
Copy link
Contributor Author

Surprisingly, it turns out that select: button is not supported (see flutter/flutter#107578), hence the crash. Adding select: would be out of scope of this PR.

@hellohuanlin hellohuanlin force-pushed the text_input_edit_rotor_accessibility branch from 239b294 to bf10ef4 Compare August 23, 2024 20:44
@hellohuanlin hellohuanlin requested a review from jmagman August 23, 2024 20:45
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

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2024
@auto-submit auto-submit bot merged commit c346a96 into flutter:main Aug 26, 2024
29 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 27, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 27, 2024
…ions) (#154153)

Manual roll requested by [email protected]

flutter/engine@f645ca5...b41ca79

2024-08-26 [email protected] [Impeller] fix incorrect origins for mesh gradient computation. (flutter/engine#54762)
2024-08-26 [email protected] Change the `ci/analyze.sh` script to analyze _all_ of the engine (flutter/engine#54779)
2024-08-26 [email protected] Use GNI group instead of hardcoding PNG codecs source files. (flutter/engine#54781)
2024-08-26 [email protected] [ios] Fix text input edit rotor accessibility (flutter/engine#54351)
2024-08-26 [email protected] Ensure orchestrators aren't assigned to 32 core machines (flutter/engine#54754)

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 [email protected],[email protected],[email protected] 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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…ions) (flutter#154153)

Manual roll requested by [email protected]

flutter/engine@f645ca5...b41ca79

2024-08-26 [email protected] [Impeller] fix incorrect origins for mesh gradient computation. (flutter/engine#54762)
2024-08-26 [email protected] Change the `ci/analyze.sh` script to analyze _all_ of the engine (flutter/engine#54779)
2024-08-26 [email protected] Use GNI group instead of hardcoding PNG codecs source files. (flutter/engine#54781)
2024-08-26 [email protected] [ios] Fix text input edit rotor accessibility (flutter/engine#54351)
2024-08-26 [email protected] Ensure orchestrators aren't assigned to 32 core machines (flutter/engine#54754)

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 [email protected],[email protected],[email protected] 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
@luomo-pro
Copy link

luomo-pro commented Sep 11, 2024

@hellohuanlin
Hello, after testing, I found that it's not perfect yet. There are still two issues:

  1. After selecting all content, the "select all" operation is still available in the rotor.
  2. Operations can only be performed on the text field that has the keyboard focus activated.

As I mentioned in flutter/flutter#151029 :

Suppose there are two text fields on an interface.

  1. Double-tap to activate the first text field, and the keyboard pops up.
  2. Then, use VoiceOver to focus on the second text field. Note: just focus on it, don't double-tap.
  3. Finally, use the rotor to perform a paste operation.

Native behavior: The text will be pasted into the second text field.
Flutter behavior: Unable to perform the paste operation.

In other words, the native rotor operation targets the text field that VoiceOver is focused on.
However, Flutter rotor operation only targets the text field that has the keyboard activated.

@hellohuanlin
Copy link
Contributor Author

@luomo-pro

After selecting all content, the "select all" operation is still available in the rotor.

I can probably put up a PR to disable selectAll in that case

Operations can only be performed on the text field that has the keyboard focus activated.

This has been the existing behavior before I reverted the PR, so not a regression. Can you create a new issue for that?

@luomo-pro
Copy link

@hellohuanlin
Okay, thank you very much. I will submit a separate issue for the second question

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-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS VoiceOver accessibility regression: EditableText rotor actions only available when keyboard is focused
4 participants