Closed dunkelbraun closed 7 months ago
Describe the bug When using the Autocomplete component, inputAttributes do not propagate to the input element.
inputAttributes
To Reproduce Set inputAttributes in the Autocomplete component, for example autoComplete: "off".
autoComplete: "off"
<Autocomplete name="fruit" placeholder="Pick your food" value={value} onChange={handleChange} inputAttributes={{ autoComplete: "off", }} > {options.map((option) => ( <Autocomplete.Item key={option} value={option}> {option} </Autocomplete.Item> ))} </Autocomplete>
Preview: https://codesandbox.io/p/sandbox/muddy-silence-xljnfp
Expected behavior The input element should have `autocomplete="off" as attribute.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context In the source code of Autocomplete.js, inputAttributes on TextField is set to attributes instead of textFieldProps.inputAttributes.
TextField
attributes
textFieldProps.inputAttributes
React.createElement(DropdownMenu.Trigger, null, (_a) => { var { ref } = _a, attributes = __rest(_a, ["ref"]); return (React.createElement(TextField, Object.assign({}, textFieldProps, { name: name, onChange: handleChange, // Ignoring the type check since TS can't infer the correct html element type attributes: Object.assign(Object.assign({}, textFieldProps.attributes), { ref }), inputAttributes: Object.assign(Object.assign({}, attributes), { onFocus: (e) => { var _a; (_a = attributes.onFocus) === null || _a === void 0 ? void 0 : _a.call(attributes); handleFocus(e); }, ref: inputRef, role: "combobox" }) }))); })
Thanks for reporting, I'll take a look and ship a patch today
Can you check if it works for you in 2.6.4?
Works for me in 2.6.4.
Thank you.
What a quick turnaround! ππ
Describe the bug When using the Autocomplete component,
inputAttributes
do not propagate to the input element.To Reproduce Set inputAttributes in the Autocomplete component, for example
autoComplete: "off"
.Preview: https://codesandbox.io/p/sandbox/muddy-silence-xljnfp
Expected behavior The input element should have `autocomplete="off" as attribute.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context In the source code of Autocomplete.js,
inputAttributes
onTextField
is set toattributes
instead oftextFieldProps.inputAttributes
.