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 { ...@@ -121,11 +121,8 @@ export class MathInputComponent implements AfterViewInit, OnChanges, OnDestroy {
} }
onFocusIn() { onFocusIn() {
// give iqb keyboard time to animate this.focusIn.emit(this.mathFieldElement);
setTimeout(() => { window.mathVirtualKeyboard.show({ firstLayer: true, resetShift: true });
this.focusIn.emit(this.mathFieldElement);
window.mathVirtualKeyboard.show({ firstLayer: true, resetShift: true });
}, 250);
} }
private setKeyboardLayout(): void { private setKeyboardLayout(): void {
......
...@@ -45,6 +45,7 @@ export abstract class TextInputGroupDirective extends ElementFormGroupDirective ...@@ -45,6 +45,7 @@ export abstract class TextInputGroupDirective extends ElementFormGroupDirective
this.mathKeyboardService this.mathKeyboardService
.toggle(focusedTextInput as { inputElement: MathfieldElement; focused: boolean }, .toggle(focusedTextInput as { inputElement: MathfieldElement; focused: boolean },
elementComponent); elementComponent);
this.forceCloseKeyboard();
} else if (!(elementComponent instanceof MathFieldComponent)) { } else if (!(elementComponent instanceof MathFieldComponent)) {
if (elementComponent.elementModel.showSoftwareKeyboard && !elementComponent.elementModel.readOnly) { if (elementComponent.elementModel.showSoftwareKeyboard && !elementComponent.elementModel.readOnly) {
promises.push(this.keyboardService promises.push(this.keyboardService
...@@ -69,12 +70,26 @@ export abstract class TextInputGroupDirective extends ElementFormGroupDirective ...@@ -69,12 +70,26 @@ export abstract class TextInputGroupDirective extends ElementFormGroupDirective
this.isKeypadOpen = this.keypadService.isOpen; this.isKeypadOpen = this.keypadService.isOpen;
if (this.keyboardService.isOpen || this.keypadService.isOpen) { if (this.keyboardService.isOpen || this.keypadService.isOpen) {
this.inputElement = this.getInputElement(focusedTextInput.inputElement); 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 // eslint-disable-next-line class-methods-use-this
checkInputLimitation(event: { checkInputLimitation(event: {
keyboardEvent: KeyboardEvent; 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