mirror of
https://github.com/CompassConnections/Compass.git
synced 2025-12-23 22:18:43 -05:00
Autofocus
This commit is contained in:
@@ -38,6 +38,16 @@ export function SelectUsers(props: {
|
||||
const requestId = useRef(0)
|
||||
const queryReady = query.length > 1
|
||||
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
// Wait for the modal (and transition) to finish
|
||||
const timeout = setTimeout(() => {
|
||||
inputRef.current?.focus()
|
||||
}, 100)
|
||||
return () => clearTimeout(timeout)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const id = ++requestId.current
|
||||
if (queryReady) {
|
||||
@@ -66,6 +76,7 @@ export function SelectUsers(props: {
|
||||
<>
|
||||
<Col className="relative mt-1 w-full rounded-md">
|
||||
<Input
|
||||
ref={inputRef}
|
||||
type="text"
|
||||
name="user name"
|
||||
id="user name"
|
||||
|
||||
Reference in New Issue
Block a user