mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
20 lines
349 B
TypeScript
20 lines
349 B
TypeScript
import { Component, createRef } from 'inferno';
|
|
|
|
export class Autofocus extends Component {
|
|
ref = createRef<HTMLDivElement>();
|
|
|
|
componentDidMount() {
|
|
setTimeout(() => {
|
|
this.ref.current?.focus();
|
|
}, 1);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div ref={this.ref} tabIndex={-1}>
|
|
{this.props.children}
|
|
</div>
|
|
);
|
|
}
|
|
}
|