Skip to content

Commit

Permalink
fix accessibility on focusable elements
Browse files Browse the repository at this point in the history
  • Loading branch information
slax57 committed Oct 25, 2022
1 parent 1ed4d31 commit 3b2817d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/ra-ui-materialui/src/list/filter/FilterFormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export const FilterFormInput = props => {
data-source={filterElement.props.source}
className={clsx('filter-field', className)}
>
{React.cloneElement(filterElement, {
resource,
record: emptyRecord,
size: 'small',
helperText: false,
// ignore defaultValue in Field because it was already set in Form (via mergedInitialValuesWithDefaultValues)
defaultValue: undefined,
})}
{!filterElement.props.alwaysOn && (
<IconButton
className={clsx(
Expand All @@ -30,14 +38,6 @@ export const FilterFormInput = props => {
<ActionHide />
</IconButton>
)}
{React.cloneElement(filterElement, {
resource,
record: emptyRecord,
size: 'small',
helperText: false,
// ignore defaultValue in Field because it was already set in Form (via mergedInitialValuesWithDefaultValues)
defaultValue: undefined,
})}
<div className={FilterFormInputClasses.spacer}>&nbsp;</div>
</Root>
);
Expand Down Expand Up @@ -66,9 +66,9 @@ const Root = styled('div', {
pointerEvents: 'auto',
position: 'relative',
'@media (hover: hover)': {
'&:hover': {
'&:not(:hover, :focus, :active, :focus-visible, :focus-within)': {
[`& .${FilterFormInputClasses.hideButton}`]: {
display: 'flex',
visibility: 'hidden',
},
},
},
Expand All @@ -80,9 +80,7 @@ const Root = styled('div', {
right: 0,
top: 0,
zIndex: 10,
'@media (hover: hover)': {
display: 'none',
},
display: 'flex',
},
}));

Expand Down

0 comments on commit 3b2817d

Please sign in to comment.