Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sixty-forks-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-select": patch
---

Fix react-select ignoring HTML5 "form" attribute
5 changes: 5 additions & 0 deletions packages/react-select/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ export type Props = {
tabSelectsValue: boolean,
/* The value of the select; reflected by the selected option */
value: ValueType,
/* Sets the form attribute on the input */
form?: string,
};

export const defaultProps = {
Expand Down Expand Up @@ -1397,6 +1399,7 @@ export default class Select extends Component<Props, State> {
inputId,
inputValue,
tabIndex,
form,
} = this.props;
const { Input } = this.components;
const { inputIsHidden } = this.state;
Expand All @@ -1422,6 +1425,7 @@ export default class Select extends Component<Props, State> {
readOnly
disabled={isDisabled}
tabIndex={tabIndex}
form={form}
value=""
{...ariaAttributes}
/>
Expand All @@ -1447,6 +1451,7 @@ export default class Select extends Component<Props, State> {
selectProps={selectProps}
spellCheck="false"
tabIndex={tabIndex}
form={form}
theme={theme}
type="text"
value={inputValue}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-select/src/components/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type InputProps = PropsWithStyles & {
/** Whether the input is disabled */
isDisabled?: boolean,
className?: string,
/** The ID of the form that the input belongs to */
form?: string,
};

export const inputCSS = ({
Expand Down