File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,10 @@ export abstract class UIScreen {
5959 if ( ! this . _formShown ) {
6060 this . _formShown = true ;
6161 this . _form . form . style . display = "block" ;
62- this . _getInputToFocusOn ( ) . focus ( ) ;
62+ const inputToFocusOn = this . _getInputToFocusOn ( ) ;
63+ if ( inputToFocusOn !== null ) {
64+ inputToFocusOn . focus ( ) ;
65+ }
6366 this . _connectEvents ( ) ;
6467 }
6568 }
@@ -85,7 +88,7 @@ export abstract class UIScreen {
8588
8689 protected abstract _initForm ( ) : void ;
8790 protected abstract _wigglePasswordInput ( ) : void ;
88- protected abstract _getInputToFocusOn ( ) : HTMLInputElement | HTMLButtonElement ;
91+ protected abstract _getInputToFocusOn ( ) : HTMLInputElement | HTMLButtonElement | null ;
8992 protected abstract _enableOrDisableSubmitButton ( ) : boolean ;
9093
9194 /**
Original file line number Diff line number Diff line change @@ -162,7 +162,8 @@ export class ExamModeUI extends UIScreen {
162162 console . error ( message ) ;
163163 }
164164
165- protected _getInputToFocusOn ( ) : HTMLButtonElement {
166- return ( this . _form as UIExamModeElements ) . examStartButton ;
165+ protected _getInputToFocusOn ( ) : HTMLButtonElement | null {
166+ return null ; // Don't focus on any input field, there are none.
167+ // There is a button we could focus on but then pressing enter/space will trigger the button even when the display is blanking
167168 }
168169}
You can’t perform that action at this time.
0 commit comments