Files
CHOMPStation2/tgui/packages/tgui_ch/components/Autofocus.tsx
2023-05-23 17:43:01 +02:00

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>
);
}
}