Skip to content
Snippets Groups Projects
Commit 35bbf05c authored by jojohoch's avatar jojohoch
Browse files

Make sure that math and IQB keyboard can't be open at the same time

- Remove the delay when opening the math keyboard in favor of an
explicit check
parent 43ba6530
No related branches found
No related tags found
No related merge requests found
......@@ -121,11 +121,8 @@ export class MathInputComponent implements AfterViewInit, OnChanges, OnDestroy {
}
onFocusIn() {
// give iqb keyboard time to animate
setTimeout(() => {
this.focusIn.emit(this.mathFieldElement);
window.mathVirtualKeyboard.show({ firstLayer: true, resetShift: true });
}, 250);
this.focusIn.emit(this.mathFieldElement);
window.mathVirtualKeyboard.show({ firstLayer: true, resetShift: true });
}
private setKeyboardLayout(): void {
......
......@@ -45,6 +45,7 @@ export abstract class TextInputGroupDirective extends ElementFormGroupDirective
this.mathKeyboardService
.toggle(focusedTextInput as { inputElement: MathfieldElement; focused: boolean },
elementComponent);
this.forceCloseKeyboard();
} else if (!(elementComponent instanceof MathFieldComponent)) {
if (elementComponent.elementModel.showSoftwareKeyboard && !elementComponent.elementModel.readOnly) {
promises.push(this.keyboardService
......@@ -69,12 +70,26 @@ export abstract class TextInputGroupDirective extends ElementFormGroupDirective
this.isKeypadOpen = this.keypadService.isOpen;
if (this.keyboardService.isOpen || this.keypadService.isOpen) {
this.inputElement = this.getInputElement(focusedTextInput.inputElement);
this.forceCloseMathKeyboard();
}
});
}
}
}
private forceCloseKeyboard(): void {
if (this.mathKeyboardService.isOpen && this.keyboardService.isOpen) {
this.keyboardService.close();
this.unsubscribeFromKeyboardEvents();
}
}
private forceCloseMathKeyboard(): void {
if (this.mathKeyboardService.isOpen && this.keyboardService.isOpen) {
this.mathKeyboardService.close();
}
}
// eslint-disable-next-line class-methods-use-this
checkInputLimitation(event: {
keyboardEvent: KeyboardEvent;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment