Merge pull request #17016 from calixteman/alt_text_button_no_menu

[Editor] Disable context menu on alt-text button and in the associated dialog
This commit is contained in:
calixteman 2023-09-23 14:22:30 +02:00 committed by GitHub
commit d2e34dff93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -834,6 +834,8 @@ class AnnotationEditor {
altText.textContent = msg; altText.textContent = msg;
altText.setAttribute("aria-label", msg); altText.setAttribute("aria-label", msg);
altText.tabIndex = "0"; altText.tabIndex = "0";
altText.addEventListener("contextmenu", AnnotationEditor.#noContextMenu);
altText.addEventListener("pointerdown", event => event.stopPropagation());
altText.addEventListener( altText.addEventListener(
"click", "click",
event => { event => {

View File

@ -78,6 +78,11 @@ class AltTextManager {
this.#container = container; this.#container = container;
dialog.addEventListener("close", this.#close.bind(this)); dialog.addEventListener("close", this.#close.bind(this));
dialog.addEventListener("contextmenu", event => {
if (event.target !== this.#textarea) {
event.preventDefault();
}
});
cancelButton.addEventListener("click", this.#finish.bind(this)); cancelButton.addEventListener("click", this.#finish.bind(this));
saveButton.addEventListener("click", this.#save.bind(this)); saveButton.addEventListener("click", this.#save.bind(this));
optionDescription.addEventListener("change", this.#boundUpdateUIState); optionDescription.addEventListener("change", this.#boundUpdateUIState);