Skip to content

Commit d1a1c9f

Browse files
committed
remove focus from exam start button in exam mode
1 parent c8b68b1 commit d1a1c9f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

client/uis/screen.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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
/**

client/uis/screens/examscreen.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)