Commit 7158646b authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

[accessibility] Announce index of tab in tab bar (#10664)

* [accessibility] Announce index if tab in tab bar

* added TODO
parent 1a1bbacf
......@@ -729,14 +729,21 @@ class _TabBarState extends State<TabBar> {
// Add the tap handler to each tab. If the tab bar is scrollable
// then give all of the tabs equal flexibility so that their widths
// reflect the intrinsic width of their labels.
for (int index = 0; index < widget.tabs.length; index++) {
final int tabCount = widget.tabs.length;
for (int index = 0; index < tabCount; index++) {
wrappedTabs[index] = new MergeSemantics(
child: new Semantics(
selected: index == _currentIndex,
child: new InkWell(
onTap: () { _handleTap(index); },
child: wrappedTabs[index],
),
child: new Stack(
children: <Widget>[
new InkWell(
onTap: () { _handleTap(index); },
child: wrappedTabs[index],
),
new Semantics(
selected: index == _currentIndex,
// TODO(goderbauer): I10N-ify
label: 'Tab ${index + 1} of $tabCount',
),
],
),
);
if (!widget.isScrollable)
......
......@@ -940,14 +940,14 @@ void main() {
id: 2,
actions: SemanticsAction.tap.index,
flags: SemanticsFlags.isSelected.index,
label: 'TAB #0',
label: 'TAB #0\nTab 1 of 2',
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, 46.0),
transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
),
new TestSemantics(
id: 4,
id: 5,
actions: SemanticsAction.tap.index,
label: 'TAB #1',
label: 'TAB #1\nTab 2 of 2',
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, 46.0),
transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
),
......
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