From 8fac33cb8b92a415d9051c3d97cd19e807773a8c Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 4 Mar 2020 06:17:15 +0000 Subject: [PATCH] Fixed a problem with how focus was being set. --- web/src/App.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index ba3796b..cc40bca 100644 --- a/web/src/App.js +++ b/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 ; }