Fixed a problem with how focus was being set.

master
Pacman Ghost 4 years ago
parent f467b2786b
commit 8fac33cb8b
  1. 10
      web/src/App.js

@ -200,15 +200,19 @@ export class App extends React.Component
componentDidUpdate() {
// we've finished rendering the page, check if we should set focus
if ( this._setFocusTo ) {
// yup - set focus to the requested control
if ( this._setFocusTo.current )
this._setFocusTo.current.focus() ;
else
this._setFocusTo.focus() ;
}
else {
let elem = document.getElementById( "search-results" ) ;
if ( elem )
setTimeout( () => elem.focus(), 10 ) ;
// nope - set focus to the search results (so that Page Up/Down et.al. will work)
if ( ! this._modalFormRef.current ) {
let elem = document.getElementById( "search-results" ) ;
if ( elem )
setTimeout( () => elem.focus(), 10 ) ;
}
}
this._setFocusTo = null ;
}

Loading…
Cancel
Save