Skip to content

[web:a11y] primary/secondary role managers #126384

@yjbanov

Description

@yjbanov

Is there an existing issue for this?

Steps to reproduce

This is a technical debt issue, not a bug report or a feature request.

Each SemanticsObject may have zero or more roles associated with it. Which ones are assigned depends on the combination of flags and actions. This works, but code readability isn't great. For instance, it's not clear who is responsible for the role ARIA attribute. Any role manager can assign one, potentially stepping on another role manager. It's not clear in what order role managers are updated.

A better approach might be to assign one primary role, and internally the primary role manager may add as many secondary role managers as it needs. Only the primary role is responsible for assigning the role label. It also determine the order, in which it and secondary role managers update the node.

Examples:

  • Primary role "button" may have secondary roles "labelled" and "focusable".
  • Primary role "text" may have secondary role "labelled". It may also add "focusable" if isFocusable is set on the object.
  • Primary role "text field" may not have any secondary roles because of bespoke needs for labelling, focus management, etc.

Expected results

Cleaner code

Actual results

Code not so clean

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)c: tech-debtTechnical debt, code quality, testing, etc.engineflutter/engine related. See also e: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions