diff options
author | Aien Saidi <aien.saidi@gmail.com> | 2021-03-24 18:49:17 +0100 |
---|---|---|
committer | Sascha <GlancingMind@outlook.com> | 2021-04-07 13:08:26 +0200 |
commit | 72fc0ef73e6c8063075a77bcf37fc8bd7e4c8baf (patch) | |
tree | 4851d9a5124fc661bf3647a2d558c08c6000bd78 /webui/src/pages | |
parent | 1216fb1e27919c58c3df81950adaf556bdb73594 (diff) | |
download | git-bug-72fc0ef73e6c8063075a77bcf37fc8bd7e4c8baf.tar.gz |
fix: issue with keyDown propagation
Diffstat (limited to 'webui/src/pages')
-rw-r--r-- | webui/src/pages/list/Filter.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/webui/src/pages/list/Filter.tsx b/webui/src/pages/list/Filter.tsx index 2ba6ffaf..782c2041 100644 --- a/webui/src/pages/list/Filter.tsx +++ b/webui/src/pages/list/Filter.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import { LocationDescriptor } from 'history'; -import React, { useRef, useState } from 'react'; +import React, { useRef, useState, useEffect } from 'react'; import { Link } from 'react-router-dom'; import Menu from '@material-ui/core/Menu'; @@ -117,8 +117,13 @@ function FilterDropdown({ const [open, setOpen] = useState(false); const [filter, setFilter] = useState<string>(''); const buttonRef = useRef<HTMLButtonElement>(null); + const searchRef = useRef<HTMLButtonElement>(null); const classes = useStyles({ active: false }); + useEffect(() => { + searchRef && searchRef.current && searchRef.current.focus(); + }, [filter]); + const content = ( <> {Icon && <Icon fontSize="small" classes={{ root: classes.icon }} />} @@ -139,6 +144,7 @@ function FilterDropdown({ </button> <Menu getContentAnchorEl={null} + ref={searchRef} anchorOrigin={{ vertical: 'bottom', horizontal: 'left', @@ -163,6 +169,7 @@ function FilterDropdown({ const { value } = e.target; setFilter(value); }} + onKeyDown={(e) => e.stopPropagation()} value={filter} label={`Filter ${children}`} /> |