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
e8670de0
Unverified
Commit
e8670de0
authored
Jul 01, 2020
by
gaaclarke
Committed by
GitHub
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Tweaking Material Chip a11y semantics to match buttons (#60141)" (#60645)
parent
d30c987c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
151 deletions
+2
-151
chip.dart
packages/flutter/lib/src/material/chip.dart
+1
-2
chip_test.dart
packages/flutter/test/material/chip_test.dart
+1
-149
No files found.
packages/flutter/lib/src/material/chip.dart
View file @
e8670de0
...
...
@@ -1944,10 +1944,9 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
),
);
return
Semantics
(
button:
widget
.
tapEnabled
,
container:
true
,
selected:
widget
.
selected
,
enabled:
widget
.
tapEnabled
?
canTap
:
null
,
enabled:
canTap
?
widget
.
isEnabled
:
null
,
child:
result
,
);
}
...
...
packages/flutter/test/material/chip_test.dart
View file @
e8670de0
...
...
@@ -1624,10 +1624,6 @@ void main() {
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
],
),
],
),
...
...
@@ -1666,10 +1662,6 @@ void main() {
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Delete'
,
...
...
@@ -1720,7 +1712,6 @@ void main() {
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
],
...
...
@@ -1772,7 +1763,6 @@ void main() {
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
],
...
...
@@ -1818,7 +1808,6 @@ void main() {
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSelected
,
...
...
@@ -1864,10 +1853,7 @@ void main() {
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
],
flags:
<
SemanticsFlag
>[],
actions:
<
SemanticsAction
>[],
),
],
...
...
@@ -1881,140 +1867,6 @@ void main() {
semanticsTester
.
dispose
();
});
testWidgets
(
'tapEnabled explicitly false'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
RawChip
(
tapEnabled:
false
,
label:
Text
(
'test'
),
),
),
));
expect
(
semanticsTester
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[],
// Must not be a button when tapping is disabled.
actions:
<
SemanticsAction
>[],
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
semanticsTester
.
dispose
();
});
testWidgets
(
'enabled when tapEnabled and canTap'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
SemanticsTester
(
tester
);
// These settings make a Chip which can be tapped, both in general and at this moment.
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
RawChip
(
isEnabled:
true
,
tapEnabled:
true
,
onPressed:
()
{},
label:
const
Text
(
'test'
),
),
),
));
expect
(
semanticsTester
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
semanticsTester
.
dispose
();
});
testWidgets
(
'disabled when tapEnabled but not canTap'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
SemanticsTester
(
tester
);
// These settings make a Chip which _could_ be tapped, but not currently (ensures `canTap == false`).
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
RawChip
(
isEnabled:
true
,
tapEnabled:
true
,
label:
Text
(
'test'
),
),
),
));
expect
(
semanticsTester
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'test'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isButton
,
],
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
semanticsTester
.
dispose
();
});
});
testWidgets
(
'can be tapped outside of chip delete icon'
,
(
WidgetTester
tester
)
async
{
...
...
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