Skip to content

[Semantics] Add support for setting the heading level #97894

Closed

Description

@vsomayaji

Use case

Using SemanticsProperties.header, we can configure an element with the heading role. However, because there isn't a way to set the level of the heading, all headings on the page default to level 2.

Proposal

Allow setting the heading level through something like SemanticsProperties.headerLevel. This could map to aria-level on web and AccessibilityHeadingLevel on iOS. I'm not sure if there's an equivalent on Android.

Activity

  1. added
    in triagePresently being triaged by the triage team
    a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: new featureNothing broken; request for a new capability
    and removed
    in triagePresently being triaged by the triage team
    on Feb 7, 2022
  2. goderbauer commented on Feb 9, 2022

    @goderbauer
    Member

    Is that information used for anything by a11y tools?

    For iOS looks like this was recently added in iOS 15.

  3. added
    P3Issues that are less important to the Flutter project
    on Feb 9, 2022
  4. ryan-bishop commented on Feb 10, 2022

    @ryan-bishop

    @goderbauer yes, headings especially when it relates to web, are used for navigation. Screen reader users can either press 1 through 6 to navigate to various heading levels, or use the H key to jump between all headings on a page. You can find more information in WCAG guideline 2.4.6 (Headings and labels)
    https://www.w3.org/WAI/WCAG21/Understanding/headings-and-labels.html

  5. fideldonson commented on May 15, 2023

    @fideldonson

    aria-level is a required attribute of the heading role and as such heading is not valid if aria-level is not present.
    https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level

  6. added a commit that references this issue on Jun 5, 2024
  7. added a commit that references this issue on Jun 5, 2024
  8. localpcguy commented on Jun 5, 2024

    @localpcguy

    The PR that says it fixes this issue is explicitly only for Web Semantics, and does not appear to address setting the iOS AccessibilityHeadingLevel property at all. I didn't see mention of that in the PR comments, but I hesitate to comment there as it's already merged.

    Did I miss it or was it handled elsewhere? If not, is this something we can make sure is also addressed either before this issue is considered closed or by making sure there is an issue specific to the iOS AccessibilityHeadingLevel so it is set properly?

  9. github-actions commented on Jun 20, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)c: new featureNothing broken; request for a new capabilitycustomer: castawaycustomer: troyframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions