Skip to content

Commit d8bbebe

Browse files
author
The one with the braid | Dфҿ mit dem Zopf
authored
[web_ui] Fixed aria-live attribute on web (flutter#27985)
* Fixed aria-live attribute on web
1 parent 7ec35b0 commit d8bbebe

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ Hidenori Matsubayashi <[email protected]>
2020
Sarbagya Dhaubanjar <[email protected]>
2121
Callum Moffat <[email protected]>
2222
Koutaro Mori <[email protected]>
23+
TheOneWithTheBraid <[email protected]>

lib/web_ui/lib/src/engine/semantics/semantics_helper.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ class DesktopSemanticsEnabler extends SemanticsEnabler {
174174

175175
@override
176176
html.Element prepareAccessibilityPlaceholder() {
177-
final html.Element placeholder = _semanticsPlaceholder = html.Element.tag('flt-semantics-placeholder');
177+
final html.Element placeholder =
178+
_semanticsPlaceholder = html.Element.tag('flt-semantics-placeholder');
178179

179180
// Only listen to "click" because other kinds of events are reported via
180181
// PointerBinding.
@@ -189,7 +190,7 @@ class DesktopSemanticsEnabler extends SemanticsEnabler {
189190
// to the assistive technology user.
190191
placeholder
191192
..setAttribute('role', 'button')
192-
..setAttribute('aria-live', 'true')
193+
..setAttribute('aria-live', 'polite')
193194
..setAttribute('tabindex', '0')
194195
..setAttribute('aria-label', placeholderMessage);
195196

@@ -372,7 +373,8 @@ class MobileSemanticsEnabler extends SemanticsEnabler {
372373

373374
@override
374375
html.Element prepareAccessibilityPlaceholder() {
375-
final html.Element placeholder = _semanticsPlaceholder = html.Element.tag('flt-semantics-placeholder');
376+
final html.Element placeholder =
377+
_semanticsPlaceholder = html.Element.tag('flt-semantics-placeholder');
376378

377379
// Only listen to "click" because other kinds of events are reported via
378380
// PointerBinding.

lib/web_ui/test/engine/semantics/semantics_helper_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ void testMain() {
3535
EngineSemanticsOwner.instance.semanticsEnabled = false;
3636
});
3737

38-
test('prepare accesibility placeholder', () async {
38+
test('prepare accessibility placeholder', () async {
3939
expect(_placeholder!.getAttribute('role'), 'button');
40-
expect(_placeholder!.getAttribute('aria-live'), 'true');
40+
expect(_placeholder!.getAttribute('aria-live'), 'polite');
4141
expect(_placeholder!.getAttribute('tabindex'), '0');
4242

4343
html.document.body!.append(_placeholder!);
@@ -72,7 +72,7 @@ void testMain() {
7272
});
7373

7474
test(
75-
'Relevants events targeting placeholder should not be forwarded to the framework',
75+
'Relevant events targeting placeholder should not be forwarded to the framework',
7676
() async {
7777
final html.Event event = html.MouseEvent('mousedown');
7878
_placeholder!.dispatchEvent(event);
@@ -110,15 +110,15 @@ void testMain() {
110110
EngineSemanticsOwner.instance.semanticsEnabled = false;
111111
});
112112

113-
test('prepare accesibility placeholder', () async {
113+
test('prepare accessibility placeholder', () async {
114114
expect(_placeholder!.getAttribute('role'), 'button');
115115

116116
// Placeholder should cover all the screen on a mobile device.
117117
final num bodyHeight = html.window.innerHeight!;
118-
final num bodyWidht = html.window.innerWidth!;
118+
final num bodyWidth = html.window.innerWidth!;
119119

120120
expect(_placeholder!.getBoundingClientRect().height, bodyHeight);
121-
expect(_placeholder!.getBoundingClientRect().width, bodyWidht);
121+
expect(_placeholder!.getBoundingClientRect().width, bodyWidth);
122122
});
123123

124124
test('Non-relevant events should be forwarded to the framework',

0 commit comments

Comments
 (0)