question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Switch` thumb not disabled when enclosed in a `disabled` `<fieldset>`

See original GitHub issue

Problem

Switch thumb not disabled when enclosed in a disabled <fieldset>.

Demo

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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
thisisclint21commented, Nov 8, 2022

Any update about how to disabled a switch?

1reaction
RobinMalfaitcommented, Jan 22, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found