Add autofocus to remote fetch modal input

This commit is contained in:
SleeplessOne1917 2023-07-22 21:29:46 -04:00
parent fa37321dbd
commit d6ed83d92f

View file

@ -80,11 +80,27 @@ export function SubscribeButton({
);
}
function focusInput() {
document.getElementById("remoteFetchInstance")?.focus();
}
class RemoteFetchModal extends Component {
constructor(props, context) {
super(props, context);
}
componentDidMount() {
document
.getElementById("remoteFetchModal")
?.addEventListener("shown.bs.modal", focusInput);
}
componentWillUnmount(): void {
document
.getElementById("remoteFetchModal")
?.removeEventListener("shown.bs.modal", focusInput);
}
render() {
return (
<div