mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove UIAccessibilityTraitKeyboardKey to fix touch typing (flutter/engine#52333)
`UIAccessibilityTraitKeyboardKey` was added in https://github.com/flutter/engine/pull/4575 so that `TextInputSemanticsObject` supported VoiceOver gestures for text editing features, such as pinch to select text, and up/down fling to move cursor. After experimenting with it, I found that those features were still available even after removing `UIAccessibilityTraitKeyboardKey`. Fixes https://github.com/flutter/flutter/issues/94465. In Touch Typing Mode: https://github.com/flutter/engine/assets/15619084/ccfe90ff-d3bc-427b-b1aa-9ec1242c0c89 In Standard Typing Mode: https://github.com/flutter/engine/assets/15619084/c78b1fb0-0816-41fb-9dd5-ed8b8a4cda2d [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
e8db04338d
commit
f2c245f93e
@ -10,6 +10,7 @@
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTouchInterceptingView_Test.h"
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h"
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObjectTestMocks.h"
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h"
|
||||
|
||||
FLUTTER_ASSERT_ARC
|
||||
|
||||
@ -1008,4 +1009,19 @@ FLUTTER_ASSERT_ARC
|
||||
XCTAssertNil(weakPlatformView);
|
||||
}
|
||||
|
||||
- (void)testTextInputSemanticsObject {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
flutter::SemanticsNode node;
|
||||
node.label = "foo";
|
||||
node.flags = static_cast<int32_t>(flutter::SemanticsFlags::kIsTextField) |
|
||||
static_cast<int32_t>(flutter::SemanticsFlags::kIsReadOnly);
|
||||
TextInputSemanticsObject* object = [[TextInputSemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
[object setSemanticsNode:&node];
|
||||
[object accessibilityBridgeDidFinishUpdate];
|
||||
XCTAssertEqual([object accessibilityTraits], UIAccessibilityTraitNone);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -304,12 +304,8 @@ static const UIAccessibilityTraits kUIAccessibilityTraitUndocumentedEmptyLine =
|
||||
if (![self isAccessibilityBridgeAlive]) {
|
||||
return 0;
|
||||
}
|
||||
// Adding UIAccessibilityTraitKeyboardKey to the trait list so that iOS treats it like
|
||||
// a keyboard entry control, thus adding support for text editing features, such as
|
||||
// pinch to select text, and up/down fling to move cursor.
|
||||
UIAccessibilityTraits results = [super accessibilityTraits] |
|
||||
[self textInputSurrogate].accessibilityTraits |
|
||||
UIAccessibilityTraitKeyboardKey;
|
||||
UIAccessibilityTraits results =
|
||||
[super accessibilityTraits] | [self textInputSurrogate].accessibilityTraits;
|
||||
// We remove an undocumented flag to get rid of a bug where single-tapping
|
||||
// a text input field incorrectly says "empty line".
|
||||
// See also: https://github.com/flutter/flutter/issues/52487
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user