mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Add keyboard shortcuts (#637)
* Add documentation * Fix manual styling * Add dialog for setting Movie images * Mention manual in README
This commit is contained in:
16
ui/v2.5/src/utils/focus.ts
Normal file
16
ui/v2.5/src/utils/focus.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useRef } from "react";
|
||||
|
||||
const useFocus = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const htmlElRef = useRef<any>();
|
||||
const setFocus = () => {
|
||||
const currentEl = htmlElRef.current;
|
||||
if (currentEl) {
|
||||
currentEl.focus();
|
||||
}
|
||||
};
|
||||
|
||||
return [htmlElRef, setFocus] as const;
|
||||
};
|
||||
|
||||
export default useFocus;
|
||||
Reference in New Issue
Block a user