Unverified Commit eae0c6a3 authored by auto-submit[bot]'s avatar auto-submit[bot] Committed by GitHub

Reverts "[a11y] Fix date picker cannot focus on the edit field (#143117)" (#143493)

Reverts flutter/flutter#143117

Initiated by: dnfield

Reason for reverting: made the tree red.

Original PR Author: hangyujin

Reviewed By: {QuncCccccc}

This change reverts the following previous change:
Original Description:
fixes: https://github.com/flutter/flutter/issues/143116
fixes: https://github.com/flutter/flutter/issues/141992

https://b.corp.google.com/issues/322173632
parent 846719ec
...@@ -394,7 +394,6 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton ...@@ -394,7 +394,6 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton
label: MaterialLocalizations.of(context).selectYearSemanticsLabel, label: MaterialLocalizations.of(context).selectYearSemanticsLabel,
excludeSemantics: true, excludeSemantics: true,
button: true, button: true,
container: true,
child: SizedBox( child: SizedBox(
height: _subHeaderHeight, height: _subHeaderHeight,
child: InkWell( child: InkWell(
......
...@@ -867,9 +867,7 @@ class _DatePickerHeader extends StatelessWidget { ...@@ -867,9 +867,7 @@ class _DatePickerHeader extends StatelessWidget {
switch (orientation) { switch (orientation) {
case Orientation.portrait: case Orientation.portrait:
return Semantics( return SizedBox(
container: true,
child: SizedBox(
height: _datePickerHeaderPortraitHeight, height: _datePickerHeaderPortraitHeight,
child: Material( child: Material(
color: backgroundColor, color: backgroundColor,
...@@ -889,22 +887,16 @@ class _DatePickerHeader extends StatelessWidget { ...@@ -889,22 +887,16 @@ class _DatePickerHeader extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Expanded(child: title), Expanded(child: title),
if (entryModeButton != null) if (entryModeButton != null)
Semantics( entryModeButton!,
container: true,
child: entryModeButton,
),
], ],
), ),
], ],
), ),
), ),
), ),
),
); );
case Orientation.landscape: case Orientation.landscape:
return Semantics( return SizedBox(
container: true,
child:SizedBox(
width: _datePickerHeaderLandscapeWidth, width: _datePickerHeaderLandscapeWidth,
child: Material( child: Material(
color: backgroundColor, color: backgroundColor,
...@@ -930,15 +922,11 @@ class _DatePickerHeader extends StatelessWidget { ...@@ -930,15 +922,11 @@ class _DatePickerHeader extends StatelessWidget {
if (entryModeButton != null) if (entryModeButton != null)
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 4), padding: const EdgeInsets.symmetric(horizontal: 4),
child: Semantics(
container: true,
child: entryModeButton, child: entryModeButton,
), ),
),
], ],
), ),
), ),
),
); );
} }
} }
......
...@@ -256,14 +256,11 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> { ...@@ -256,14 +256,11 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
?? theme.inputDecorationTheme.border ?? theme.inputDecorationTheme.border
?? (useMaterial3 ? const OutlineInputBorder() : const UnderlineInputBorder()); ?? (useMaterial3 ? const OutlineInputBorder() : const UnderlineInputBorder());
return Semantics( return TextFormField(
container: true,
child: TextFormField(
decoration: InputDecoration( decoration: InputDecoration(
hintText: widget.fieldHintText ?? localizations.dateHelpText, hintText: widget.fieldHintText ?? localizations.dateHelpText,
labelText: widget.fieldLabelText ?? localizations.dateInputLabel, labelText: widget.fieldLabelText ?? localizations.dateInputLabel,
).applyDefaults( ).applyDefaults(inputTheme
inputTheme
.merge(datePickerTheme.inputDecorationTheme) .merge(datePickerTheme.inputDecorationTheme)
.copyWith(border: effectiveInputBorder), .copyWith(border: effectiveInputBorder),
), ),
...@@ -274,7 +271,6 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> { ...@@ -274,7 +271,6 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
autofocus: widget.autofocus, autofocus: widget.autofocus,
controller: _controller, controller: _controller,
focusNode: widget.focusNode, focusNode: widget.focusNode,
),
); );
} }
} }
...@@ -13,7 +13,6 @@ import 'package:flutter/foundation.dart'; ...@@ -13,7 +13,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import '../widgets/clipboard_utils.dart';
void main() { void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
...@@ -1578,13 +1577,6 @@ void main() { ...@@ -1578,13 +1577,6 @@ void main() {
}); });
testWidgets('input mode', (WidgetTester tester) async { testWidgets('input mode', (WidgetTester tester) async {
// Fill the clipboard so that the Paste option is available in the text
// selection menu.
final MockClipboard mockClipboard = MockClipboard();
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, mockClipboard.handleMethodCall);
await Clipboard.setData(const ClipboardData(text: 'Clipboard data'));
addTearDown(() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, null));
final SemanticsHandle semantics = tester.ensureSemantics(); final SemanticsHandle semantics = tester.ensureSemantics();
initialEntryMode = DatePickerEntryMode.input; initialEntryMode = DatePickerEntryMode.input;
...@@ -1604,20 +1596,7 @@ void main() { ...@@ -1604,20 +1596,7 @@ void main() {
isFocusable: true, isFocusable: true,
)); ));
expect(tester.getSemantics(find.byType(EditableText)), matchesSemantics( // The semantics of the InputDatePickerFormField are tested in its tests.
label: 'Enter Date',
isTextField: true,
isFocused: true,
value: '01/15/2016',
hasTapAction: true,
hasSetTextAction: true,
hasSetSelectionAction: true,
hasCopyAction: true,
hasCutAction: true,
hasPasteAction: true,
hasMoveCursorBackwardByCharacterAction: true,
hasMoveCursorBackwardByWordAction: true,
));
// Ok/Cancel buttons // Ok/Cancel buttons
expect(tester.getSemantics(find.text('OK')), matchesSemantics( expect(tester.getSemantics(find.text('OK')), matchesSemantics(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment