Add support for setting the heading level for web semantics (#97894) (#125771)

This change adds a new property in Semantics widget that would take an integer corresponding to the heading levels defined by the ARIA heading role. This is necessary in order to get proper accessibility and usability in a website for users who rely on screen readers and other assistive technologies.

Issue fixed by this PR:
fixes https://github.com/flutter/flutter/issues/97894

Engine part:
https://github.com/flutter/engine/pull/41435
This commit is contained in:
victorgalo
2024-06-06 23:24:26 +02:00
committed by GitHub
parent 6f2d0be6b5
commit 7d525ea318
5 changed files with 73 additions and 5 deletions

View File

@@ -684,6 +684,7 @@ void main() {
customSemanticsActionIds: <int>[CustomSemanticsAction.getIdentifier(action)],
currentValueLength: 10,
maxValueLength: 15,
headingLevel: 0,
);
final _FakeSemanticsNode node = _FakeSemanticsNode(data);
@@ -970,6 +971,7 @@ void main() {
customSemanticsActionIds: <int>[CustomSemanticsAction.getIdentifier(action)],
currentValueLength: 10,
maxValueLength: 15,
headingLevel: 0,
);
final _FakeSemanticsNode node = _FakeSemanticsNode(data);
@@ -1062,6 +1064,7 @@ void main() {
platformViewId: 105,
currentValueLength: 10,
maxValueLength: 15,
headingLevel: 0,
);
final _FakeSemanticsNode node = _FakeSemanticsNode(data);
@@ -1161,6 +1164,7 @@ void main() {
platformViewId: 105,
currentValueLength: 10,
maxValueLength: 15,
headingLevel: 0,
);
final _FakeSemanticsNode emptyNode = _FakeSemanticsNode(emptyData);
@@ -1189,6 +1193,7 @@ void main() {
currentValueLength: 10,
maxValueLength: 15,
customSemanticsActionIds: <int>[CustomSemanticsAction.getIdentifier(action)],
headingLevel: 0,
);
final _FakeSemanticsNode fullNode = _FakeSemanticsNode(fullData);
@@ -1279,6 +1284,7 @@ void main() {
currentValueLength: 10,
maxValueLength: 15,
customSemanticsActionIds: <int>[CustomSemanticsAction.getIdentifier(action)],
headingLevel: 0,
);
final _FakeSemanticsNode node = _FakeSemanticsNode(data);