Merge pull request #15595 from calixteman/1793419

[Editor] Make FreeText annotations visible for screen readers when in editing mode (bug 1793419)
This commit is contained in:
calixteman 2022-10-19 19:33:49 +02:00 committed by GitHub
commit ba3a0e104a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,8 @@ class FreeTextEditor extends AnnotationEditor {
#content = ""; #content = "";
#editorDivId = `${this.id}-editor`;
#hasAlreadyBeenCommitted = false; #hasAlreadyBeenCommitted = false;
#fontSize; #fontSize;
@ -225,10 +227,10 @@ class FreeTextEditor extends AnnotationEditor {
this.parent.setEditingState(false); this.parent.setEditingState(false);
this.parent.updateToolbar(AnnotationEditorType.FREETEXT); this.parent.updateToolbar(AnnotationEditorType.FREETEXT);
super.enableEditMode(); super.enableEditMode();
this.enableEditing();
this.overlayDiv.classList.remove("enabled"); this.overlayDiv.classList.remove("enabled");
this.editorDiv.contentEditable = true; this.editorDiv.contentEditable = true;
this.div.draggable = false; this.div.draggable = false;
this.div.removeAttribute("aria-activedescendant");
this.editorDiv.addEventListener("keydown", this.#boundEditorDivKeydown); this.editorDiv.addEventListener("keydown", this.#boundEditorDivKeydown);
this.editorDiv.addEventListener("focus", this.#boundEditorDivFocus); this.editorDiv.addEventListener("focus", this.#boundEditorDivFocus);
this.editorDiv.addEventListener("blur", this.#boundEditorDivBlur); this.editorDiv.addEventListener("blur", this.#boundEditorDivBlur);
@ -243,9 +245,9 @@ class FreeTextEditor extends AnnotationEditor {
this.parent.setEditingState(true); this.parent.setEditingState(true);
super.disableEditMode(); super.disableEditMode();
this.disableEditing();
this.overlayDiv.classList.add("enabled"); this.overlayDiv.classList.add("enabled");
this.editorDiv.contentEditable = false; this.editorDiv.contentEditable = false;
this.div.setAttribute("aria-activedescendant", this.#editorDivId);
this.div.draggable = true; this.div.draggable = true;
this.editorDiv.removeEventListener("keydown", this.#boundEditorDivKeydown); this.editorDiv.removeEventListener("keydown", this.#boundEditorDivKeydown);
this.editorDiv.removeEventListener("focus", this.#boundEditorDivFocus); this.editorDiv.removeEventListener("focus", this.#boundEditorDivFocus);
@ -409,7 +411,7 @@ class FreeTextEditor extends AnnotationEditor {
this.editorDiv = document.createElement("div"); this.editorDiv = document.createElement("div");
this.editorDiv.className = "internal"; this.editorDiv.className = "internal";
this.editorDiv.setAttribute("id", `${this.id}-editor`); this.editorDiv.setAttribute("id", this.#editorDivId);
this.enableEditing(); this.enableEditing();
FreeTextEditor._l10nPromise FreeTextEditor._l10nPromise