-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select] Not inheriting disabled
from parent fieldset
#2417
Comments
I should also add, that the underlying element gets marked as |
You can use css to remove the pointer events when the object is disabled, im using tailwindcss but you can do it with vanilla as well
|
|
I'm also running into this issue. I'm using Shadcn, which uses Radix's select implementation. One workaround is to keep track of whether the select is within a disabled fieldset or not. The
|
I used @BrendanC23's great idea, but had to put the disabled prop on the const ref = useRef<HTMLButtonElement>(null);
const isInDisabledFieldset = Boolean(ref.current?.closest("fieldset:disabled"));
return (
<Select.Root disabled={isInDisabledFieldset}>
<Select.Trigger ref={ref}>
</Select.Trigger>
</Select.Root>
); |
I opened the PR for solving this issue! Check it out! |
Bug report
Hi,
I just noticed a small, but important issue with Select Primitive.
If you wrap it with a
<fieldset disabled></fieldset>
it'll not inherit the disabled attribute. This works like this with every other "form" primitive (radio group, switch, checkbox etc) so I'd also think it should be the same for Select.Current Behavior
This works:
This doesn't:
Expected behavior
A select root to inherit disabled attribute from parent fieldset.
The text was updated successfully, but these errors were encountered: