Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139676

[a11y] "Switch" role is missing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9, 6.10
    • None
    • Android, iOS/tvOS/watchOS

      Currently there is no explicit a11y role for a switch, only for a checkbox. This is a problem on Android as an a11y element cannot be marked as a "Switch", only "Checkbox".

      Checkboxes and switches do serve similar purposes but carry a small semantic difference. Both show their (binary/ternary) state and a user can switch between their states. A checkbox is passive, like a checkbox in a form. Changing the state of a checkbox does not directly trigger an action. Changing the state of a switch can have immediate effect, like changing the theme from light to dark or revealing additional options.

      From the Material guidelines (https://m3.material.io/components/switch/guidelines):

      Use checkboxes to select multiple related options in a list.

      Use radio buttons to select a single option in a list.

      Use switches to select standalone or more verbose options in a list, like settings.

      From Microsoft (https://learn.microsoft.com/en-us/windows/apps/design/controls/checkbox):

      For a binary choice, the main difference between a check box and a toggle switch is that the check box is for status and the toggle switch is for action. You can delay committing a check box interaction (as part of a form submit, for example), while you should immediately commit a toggle switch interaction. 

      Not every guideline and standard agrees here, the W3C WAI does state that they are interchangeable (https://www.w3.org/WAI/ARIA/apg/patterns/switch/), but this point is still open for discussion: https://github.com/w3c/aria-practices/issues/2647

      Nonetheless I think there needs to be a new role to differentiate a "Switch" from a "Checkbox" for platforms that handle the roles differently.

        For Gerrit Dashboard: QTBUG-139676
        # Subject Branch Project Status CR V

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jtrillma Jens Trillmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change