Open ojj1123 opened 1 month ago
Will this react to changes? For example if the fieldset is dynamically disabled?
Will this react to changes? For example if the fieldset is dynamically disabled?
@RndUsername
Yeah, It works well. This is because disabled
state of fieldset
is checked whenever triggering onPointerDown
handler.
FYI, HTML select tag works as pointerdown
event is triggered using mouse
. [mdn] <select>
export const Styled = () => {
const [disabled, setDisabled] = React.useState(false);
return (
<div>
<button type="button" onClick={() => setDisabled((prev) => !prev)}>
{disabled ? 'enabled' : 'disabled'}
</button>
<div>
<p>Radix `Select` component</p>
<fieldset disabled={disabled}>
{POSITIONS.map((position) => (
<Label key={position}>
Choose a number:
<Select.Root defaultValue="two">
...
</Select.Root>
</Label>
))}
</fieldset>
</div>
</div>
);
};
https://github.com/user-attachments/assets/87e54158-ec68-4cc8-98d7-a32881739b5a
Description
close #2417
fieldset
,Select
component does not be disabled.Select.Trigger
hasonPointerDown
handler and even if button is disabled, that handler can be triggered.fieldset
disabled.AS-IS
https://github.com/user-attachments/assets/eb77a71e-9848-4070-8e6f-5f6ba98d092b
TO-BE
https://github.com/user-attachments/assets/632ab57c-4b5c-44dd-9a9a-19eb693918c4