`Switch` thumb not disabled when enclosed in a `disabled` `<fieldset>`
See original GitHub issueProblem
Switch
thumb not disabled when enclosed in a disabled
<fieldset>
.
Cause
All form fields (<input>
, <button>
etc.) inside a <fieldset>
are disabled. This results in the wrapping <button>
, representing the track, being disabled. However, the <span>
representing the thumb is not, as it’s not considered a form field. Thus the Switch
is still toggleable.
Workaround
Explicitly add disabled
to <button>
.
Solution
Not really sure what would be a clean solution of determining if enclosed in a (disabled
) <fieldset>
. Unfortunately the disabled
property of the <button>
is not set. Walking up the DOM is one way. Any other suggestions?
Anyway, I would assume the entire Switch
to be disabled in this case.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
How to enable one button inside a disabled fieldset
Solution 1 - use icons with click event. Use icons instead of buttons and attaching the click event to the icons. This bypasses...
Read more >Accessible Rich Internet Applications (WAI-ARIA) 1.1 - W3C
To a non-disabled user, it may look and act like a button widget, but without appropriate semantics, the button widget may not be...
Read more >Radio Button Guidelines | Wireframing Academy - Balsamiq
The disabled and indeterminate state is when an option is disabled and it has a selected child. ... In Balsamiq, you can switch...
Read more >Ext.form.FieldSet | Ext JS 6.2.0 - Sencha Documentation
A FieldSet is a great way to visually separate elements of a form. It's normally used when you ... Whether or not this...
Read more >ui.switch, API Reference Webix Docs - Documentation
This page contains ui.switch documentation to help in learning the library. ... disable, disables the calling view (makes it dimmed and unclickable).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any update about how to disabled a switch?
I’m going to try and implement a relatively easy fix inside Headless UI itself this Friday. I also saw that they answered on the React repo so maybe things will go quick enough. We’ll see.