Cannot set role of Toggle component to "button"
Environment Information
- Package version(s): 8.20.0
- Browser and OS versions: Windows 10 Enterprise Version 21H1 OS Build 19043.1052 Microsoft Edge Version 91.0.864.59
Describe the issue:
Not able to set the aria role for a Toggle component to 'button'; type error.
Please provide a reproduction of the issue in a codepen:
Actual behavior:
Type '"button"' is not assignable to type '"checkbox" | "switch" | "menuitemcheckbox" | undefined'.ts(2322) Toggle.types.d.ts(90, 5): The expected type comes from property 'role' which is declared here on type 'IntrinsicAttributes & IToggleProps & { children?: ReactNode; }' (JSX attribute) IToggleProps.role?: "switch" | "checkbox" | "menuitemcheckbox" | undefined Whether to use the 'switch' role (ARIA 1.1) or the 'checkbox' role (ARIA 1.0).
Expected behavior:
Allow use of "button" role
Documentation describing expected behavior
Microsoft Accessibility Standards (MAS) 04.01.02 Ensure that Assistive Technologies (AT) can gather information about, activate (or set) and keep up to date on the status of user interface controls in the content. For any product, service, tool or content, functionality and navigation of the content and user interface (UI) components must be programmatically exposed and operable. For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to user agents, including assistive technologies. Note: This success criterion is primarily for Web authors who develop or script their own user interface components. For example, standard HTML controls already meet this success criterion when used according to specification.
What's the scenario where you need the toggle to have role=button?
This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fluent UI!
I work for Azure Lab Services (https://labs.azure.com/) and we use this component to show the status and allow user to start or stop a VM. Accessibility team opened a bug for this citing the MAS reference above. If you need more context on the internal bug, let me know or feel free to ping me (alias: rashaf)
@miroslavstastny
Gentle ping that this issue needs attention.
Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.
Still require assistance? Please, create a new issue with up-to date details.