Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
01564c64
Unverified
Commit
01564c64
authored
Dec 09, 2021
by
Chris Bracken
Committed by
GitHub
Dec 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Windows: Focus text field on gaining a11y focus (#94898)
parent
f704b0d7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
10 deletions
+23
-10
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+2
-3
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+15
-2
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+2
-2
search_test.dart
packages/flutter/test/material/search_test.dart
+2
-1
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+2
-2
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
01564c64
...
...
@@ -1160,15 +1160,14 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
textSelectionControls
??=
cupertinoTextSelectionControls
;
break
;
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
windows
:
textSelectionControls
??=
cupertinoDesktopTextSelectionControls
;
handleDidGainAccessibilityFocus
=
()
{
// macOS automatically activated the TextField when it receives
// accessibility focus.
// Automatically activate the TextField when it receives accessibility focus.
if
(!
_effectiveFocusNode
.
hasFocus
&&
_effectiveFocusNode
.
canRequestFocus
)
{
_effectiveFocusNode
.
requestFocus
();
}
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
01564c64
...
...
@@ -1197,8 +1197,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
cursorRadius
??=
const
Radius
.
circular
(
2.0
);
cursorOffset
=
Offset
(
iOSHorizontalOffset
/
MediaQuery
.
of
(
context
).
devicePixelRatio
,
0
);
handleDidGainAccessibilityFocus
=
()
{
// macOS automatically activated the TextField when it receives
// accessibility focus.
// Automatically activate the TextField when it receives accessibility focus.
if
(!
_effectiveFocusNode
.
hasFocus
&&
_effectiveFocusNode
.
canRequestFocus
)
{
_effectiveFocusNode
.
requestFocus
();
}
...
...
@@ -1216,6 +1215,14 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
break
;
case
TargetPlatform
.
linux
:
forcePressEnabled
=
false
;
textSelectionControls
??=
desktopTextSelectionControls
;
paintCursorAboveText
=
false
;
cursorOpacityAnimates
=
false
;
cursorColor
??=
selectionTheme
.
cursorColor
??
theme
.
colorScheme
.
primary
;
selectionColor
=
selectionTheme
.
selectionColor
??
theme
.
colorScheme
.
primary
.
withOpacity
(
0.40
);
break
;
case
TargetPlatform
.
windows
:
forcePressEnabled
=
false
;
textSelectionControls
??=
desktopTextSelectionControls
;
...
...
@@ -1223,6 +1230,12 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
cursorOpacityAnimates
=
false
;
cursorColor
??=
selectionTheme
.
cursorColor
??
theme
.
colorScheme
.
primary
;
selectionColor
=
selectionTheme
.
selectionColor
??
theme
.
colorScheme
.
primary
.
withOpacity
(
0.40
);
handleDidGainAccessibilityFocus
=
()
{
// Automatically activate the TextField when it receives accessibility focus.
if
(!
_effectiveFocusNode
.
hasFocus
&&
_effectiveFocusNode
.
canRequestFocus
)
{
_effectiveFocusNode
.
requestFocus
();
}
};
break
;
}
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
01564c64
...
...
@@ -314,7 +314,7 @@ void main() {
);
});
testWidgets
(
'Activates the text field when receives semantics focus on Mac'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Activates the text field when receives semantics focus on Mac
, Windows
'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
!;
final
FocusNode
focusNode
=
FocusNode
();
...
...
@@ -362,7 +362,7 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
focusNode
.
hasFocus
,
isTrue
);
semantics
.
dispose
();
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
macOS
}));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
macOS
,
TargetPlatform
.
windows
}));
testWidgets
(
'takes available space horizontally and takes intrinsic space vertically no-strut'
,
...
...
packages/flutter/test/material/search_test.dart
View file @
01564c64
...
...
@@ -629,7 +629,8 @@ void main() {
debugDefaultTargetPlatformOverride
!=
TargetPlatform
.
macOS
)
SemanticsFlag
.
namesRoute
,
],
actions:
<
SemanticsAction
>[
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
||
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
windows
)
SemanticsAction
.
didGainAccessibilityFocus
,
SemanticsAction
.
tap
,
SemanticsAction
.
setSelection
,
...
...
packages/flutter/test/material/text_field_test.dart
View file @
01564c64
...
...
@@ -286,7 +286,7 @@ void main() {
skip:
isContextMenuProvidedByPlatform
,
// [intended] only applies to platforms where we supply the context menu.
);
testWidgets
(
'Activates the text field when receives semantics focus on Mac'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Activates the text field when receives semantics focus on Mac
, Windows
'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
!;
final
FocusNode
focusNode
=
FocusNode
();
...
...
@@ -337,7 +337,7 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
focusNode
.
hasFocus
,
isTrue
);
semantics
.
dispose
();
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
macOS
}));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
macOS
,
TargetPlatform
.
windows
}));
testWidgets
(
'TextField passes onEditingComplete to EditableText'
,
(
WidgetTester
tester
)
async
{
void
onEditingComplete
()
{
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment