Skip to content

Commit c817bac

Browse files
siriwatknphbjORbj
andauthored
Apply suggestions from code review
Co-authored-by: Benny Joo <[email protected]> Signed-off-by: Siriwat K <[email protected]>
1 parent 60e9b96 commit c817bac

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

docs/data/joy/components/autocomplete/ControllableStates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function ControllableStates() {
3535
}}
3636
inputValue={inputValue}
3737
onInputChange={(event, newInputValue) => {
38-
setInputValue(newInputValue);
38+
setInputValue(newInputValue ? `Label: ${newInputValue}` : newInputValue);
3939
}}
4040
options={options}
4141
renderInput={(params) => <Input {...params} placeholder="Controllable" />}

docs/data/joy/components/autocomplete/Playground.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export default function Playground() {
233233
<div>
234234
<FormLabel>readOnly</FormLabel>
235235
<FormHelperText>
236-
The component becomes readonly. It is also supported for multiple
236+
The component becomes read-only. It is also supported in multiple
237237
tags where the tag cannot be deleted.
238238
</FormHelperText>
239239
</div>

docs/data/joy/components/autocomplete/autocomplete.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The `Autocomplete` renders an input and a popup, after triggered by a pointer or
2626

2727
### Options structure
2828

29-
By default, the component accepts the following options structures:
29+
By default, the component accepts the following structures for `options`:
3030

3131
```ts
3232
interface AutocompleteOption {
@@ -85,11 +85,11 @@ Each of the following examples demonstrates one feature of the Autocomplete comp
8585

8686
## Free solo
8787

88-
Set `freeSolo` to true so the textbox can contain any arbitrary value.
88+
Set `freeSolo` to true so that the textbox can contain any arbitrary value.
8989

9090
### Search input
9191

92-
The prop is designed to cover the primary use case of a **search input** with suggestions, e.g. Google search or react-autowhatever.
92+
This prop is designed to cover the primary use case of a **search input** with suggestions, e.g. Google search or react-autowhatever.
9393

9494
{{"demo": "FreeSolo.js"}}
9595

@@ -218,7 +218,7 @@ The autocomplete component comes with three sizes out of the box: `sm`, `md` (th
218218
To learn how to add more sizes to the component, check out [Themed components—Extend sizes](/joy-ui/customization/themed-components/#extend-sizes).
219219
:::
220220

221-
The `size` can be controlled at the `FormControl`.
221+
The `size` can also be controlled at the `FormControl`.
222222

223223
{{"demo": "SizeWithLabel.js"}}
224224

@@ -232,7 +232,7 @@ The following demo relies on [autosuggest-highlight](https://github.com/moroshko
232232

233233
### GitHub's picker
234234

235-
To reproduce GitHub's label picker, the `Autocomplete` is rendered inside a [`PopperUnstyled`](/base/react-popper/). To remove the popup behavior from the autocomplete, replace the listbox slot with the `List` component.
235+
To reproduce GitHub's label picker, the `Autocomplete` is rendered inside a [`PopperUnstyled`](/base/react-popper/). To remove the popup behavior from the autocomplete, replace the listbox slot with the [`List`](/joy-ui/react-list/) component.
236236

237237
{{"demo": "GitHubLabel.js"}}
238238

packages/mui-base/src/AutocompleteUnstyled/useAutocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const defaultFilterOptions = createFilterOptions();
7171
const pageSize = 5;
7272

7373
const defaultIsActiveElementInListbox = (listboxRef) =>
74-
listboxRef.current !== null && listboxRef.current.parentElement.contains(document.activeElement);
74+
listboxRef.current !== null && listboxRef.current.parentElement?.contains(document.activeElement);
7575

7676
export default function useAutocomplete(props) {
7777
const {

packages/mui-joy/src/Autocomplete/AutocompleteProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ interface AutocompleteOwnProps<
235235
*/
236236
popupIcon?: React.ReactNode;
237237
/**
238-
* If `true`, the component becomes readonly. It is also supported for multiple tags where the tag cannot be deleted.
238+
* If `true`, the component becomes read-only. It is also supported in multiple tags where the tag cannot be deleted.
239239
* @default false
240240
*/
241241
readOnly?: boolean;

0 commit comments

Comments
 (0)