File tree 2 files changed +7
-2
lines changed
packages/ra-ui-materialui/src/list/filter
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ const FilterButton = (props: FilterButtonProps): JSX.Element => {
82
82
< Button
83
83
className = "add-filter"
84
84
label = "ra.action.add_filter"
85
+ aria-haspopup = "true"
85
86
onClick = { handleClickButton }
86
87
>
87
88
< ContentFilter />
@@ -91,12 +92,13 @@ const FilterButton = (props: FilterButtonProps): JSX.Element => {
91
92
anchorEl = { anchorEl . current }
92
93
onClose = { handleRequestClose }
93
94
>
94
- { hiddenFilters . map ( ( filterElement : JSX . Element ) => (
95
+ { hiddenFilters . map ( ( filterElement : JSX . Element , index ) => (
95
96
< FilterButtonMenuItem
96
97
key = { filterElement . props . source }
97
98
filter = { filterElement }
98
99
resource = { resource }
99
100
onShow = { handleShow }
101
+ autoFocus = { index === 0 }
100
102
/>
101
103
) ) }
102
104
</ Menu >
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { FieldTitle, useResourceContext } from 'ra-core';
6
6
7
7
export const FilterButtonMenuItem = forwardRef < any , FilterButtonMenuItemProps > (
8
8
( props , ref ) => {
9
- const { filter, onShow } = props ;
9
+ const { filter, onShow, autoFocus } = props ;
10
10
const resource = useResourceContext ( props ) ;
11
11
const handleShow = useCallback ( ( ) => {
12
12
onShow ( {
@@ -22,6 +22,7 @@ export const FilterButtonMenuItem = forwardRef<any, FilterButtonMenuItemProps>(
22
22
data-default-value = { filter . props . defaultValue }
23
23
key = { filter . props . source }
24
24
onClick = { handleShow }
25
+ autoFocus = { autoFocus }
25
26
ref = { ref }
26
27
>
27
28
< FieldTitle
@@ -38,10 +39,12 @@ FilterButtonMenuItem.propTypes = {
38
39
filter : PropTypes . element . isRequired ,
39
40
onShow : PropTypes . func . isRequired ,
40
41
resource : PropTypes . string ,
42
+ autoFocus : PropTypes . bool ,
41
43
} ;
42
44
43
45
export interface FilterButtonMenuItemProps {
44
46
filter : JSX . Element ;
45
47
onShow : ( params : { source : string ; defaultValue : any } ) => void ;
46
48
resource : string ;
49
+ autoFocus : boolean ;
47
50
}
You can’t perform that action at this time.
0 commit comments