@@ -841,6 +841,18 @@ abstract class SemanticsUpdateBuilder {
841841 /// z-direction starting at `elevation` . Basically, in the z-direction the
842842 /// node starts at `elevation` above the parent and ends at `elevation` +
843843 /// `thickness` above the parent.
844+ ///
845+ /// The `headingLevel` describes that this node is a heading and the hierarchy
846+ /// level this node represents as a heading. A value of 0 indicates that this
847+ /// node is not a heading. A value of 1 or greater indicates that this node is
848+ /// a heading at the specified level. The valid value range is from 1 to 6,
849+ /// inclusive. This attribute is only used for Web platform, and it will have
850+ /// no effect on other platforms.
851+ ///
852+ /// See also:
853+ ///
854+ /// * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role
855+ /// * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level
844856 void updateNode ({
845857 required int id,
846858 required int flags,
@@ -875,6 +887,7 @@ abstract class SemanticsUpdateBuilder {
875887 required Int32List childrenInTraversalOrder,
876888 required Int32List childrenInHitTestOrder,
877889 required Int32List additionalActions,
890+ int headingLevel = 0 ,
878891 });
879892
880893 /// Update the custom semantics action associated with the given `id` .
@@ -945,8 +958,13 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implem
945958 required Int32List childrenInTraversalOrder,
946959 required Int32List childrenInHitTestOrder,
947960 required Int32List additionalActions,
961+ int headingLevel = 0 ,
948962 }) {
949963 assert (_matrix4IsValid (transform));
964+ assert (
965+ headingLevel >= 0 && headingLevel <= 6 ,
966+ 'Heading level must be between 1 and 6, or 0 to indicate that this node is not a heading.'
967+ );
950968 _updateNode (
951969 id,
952970 flags,
@@ -984,6 +1002,7 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implem
9841002 childrenInTraversalOrder,
9851003 childrenInHitTestOrder,
9861004 additionalActions,
1005+ headingLevel,
9871006 );
9881007 }
9891008 @Native <
@@ -1024,7 +1043,8 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implem
10241043 Handle ,
10251044 Handle ,
10261045 Handle ,
1027- Handle )> (symbol: 'SemanticsUpdateBuilder::updateNode' )
1046+ Handle ,
1047+ Int32 )> (symbol: 'SemanticsUpdateBuilder::updateNode' )
10281048 external void _updateNode (
10291049 int id,
10301050 int flags,
@@ -1061,7 +1081,8 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1 implem
10611081 Float64List transform,
10621082 Int32List childrenInTraversalOrder,
10631083 Int32List childrenInHitTestOrder,
1064- Int32List additionalActions);
1084+ Int32List additionalActions,
1085+ int headingLevel);
10651086
10661087 @override
10671088 void updateCustomAction ({required int id, String ? label, String ? hint, int overrideId = - 1 }) {
0 commit comments