Skip to content

Commit

Permalink
[Autocomplete][Material] Add missing focusVisible class in Autocomp…
Browse files Browse the repository at this point in the history
…leteClasses (#37502)
  • Loading branch information
sai6855 committed Jun 5, 2023
1 parent c2e2008 commit 984a3c4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/pages/material-ui/api/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"fullWidth",
"expanded",
"focused",
"focusVisible",
"tag",
"tagSizeSmall",
"tagSizeMedium",
Expand All @@ -130,7 +131,11 @@
"groupLabel",
"groupUl"
],
"globalClasses": { "expanded": "Mui-expanded", "focused": "Mui-focused" },
"globalClasses": {
"expanded": "Mui-expanded",
"focused": "Mui-focused",
"focusVisible": "Mui-focusVisible"
},
"name": "MuiAutocomplete"
},
"spread": true,
Expand Down
5 changes: 5 additions & 0 deletions docs/translations/api-docs/autocomplete/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
"nodeName": "the root element",
"conditions": "focused"
},
"focusVisible": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the option elements",
"conditions": "they are keyboard focused"
},
"tag": {
"description": "Styles applied to {{nodeName}}, {{conditions}}.",
"nodeName": "the tag elements",
Expand Down
7 changes: 7 additions & 0 deletions packages/mui-material/src/Autocomplete/Autocomplete.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ function MyAutocomplete<
renderInput={(params) => <TextField {...params} value={params.inputProps.value} />}
/>;

// Test for focusVisible class
<Autocomplete
classes={{ focusVisible: 'test' }}
options={[{ label: '1' }, { label: '2' }]}
renderInput={(params) => <TextField {...params} />}
/>;

interface Option {
label: string;
value: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-material/src/Autocomplete/autocompleteClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface AutocompleteClasses {
expanded: string;
/** State class applied to the root element if focused. */
focused: string;
/** Styles applied to the option elements if they are keyboard focused. */
focusVisible: string;
/** Styles applied to the tag elements, e.g. the chips. */
tag: string;
/** Styles applied to the tag elements, e.g. the chips if `size="small"`. */
Expand Down

0 comments on commit 984a3c4

Please sign in to comment.