Skip to content

Commit 13a2792

Browse files
Hidden text field is focusable and editable with Select with isDisabled=true (#4943)
* pass isDisabled prop to HiddenSelect * Add test --------- Co-authored-by: Robert Snow <[email protected]>
1 parent 5f69479 commit 13a2792

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/react-aria-components/src/Select.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ function Select<T extends object>(props: SelectProps<T>, ref: ForwardedRef<HTMLD
169169
state={state}
170170
triggerRef={buttonRef}
171171
label={label}
172-
name={props.name} />
172+
name={props.name}
173+
isDisabled={props.isDisabled} />
173174
</Provider>
174175
</>
175176
);

packages/react-aria-components/test/Select.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,13 @@ describe('Select', () => {
177177
userEvent.click(button);
178178
expect(button).toHaveTextContent('close');
179179
});
180+
181+
it('should send disabled prop to the hidden field', () => {
182+
render(
183+
<TestSelect isDisabled />
184+
);
185+
userEvent.tab();
186+
187+
expect(document.activeElement).toBe(document.body);
188+
});
180189
});

0 commit comments

Comments
 (0)