Autofocus on the poster list
This commit is contained in:
parent
8e96d5e7ed
commit
c206336c7b
@ -116,6 +116,14 @@ export default class ListPosters extends React.PureComponent {
|
|||||||
class Posters extends React.PureComponent {
|
class Posters extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.posterRef = React.createRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
// Always focus on the poster list
|
||||||
|
if (this.posterRef.current != null) {
|
||||||
|
this.posterRef.current.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
move(event) {
|
move(event) {
|
||||||
@ -177,6 +185,7 @@ class Posters extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div tabIndex="0"
|
<div tabIndex="0"
|
||||||
|
ref={this.posterRef}
|
||||||
onKeyDown={(event) => this.move(event)}
|
onKeyDown={(event) => this.move(event)}
|
||||||
className="poster-list"
|
className="poster-list"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user