mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
[Editor] Report telemetry when closing the altText dialog with Esc
(PR 16987 follow-up)
The dialog element handles closing with <kbd>Esc</kbd> automatically, however we're not reporting telemetry in that case. In order to fix that the easiest solution, as far as I'm concerned, seem to be moving the telemetry reporting into the dialog-close handler since it's always invoked.
This commit is contained in:
parent
d555f351d3
commit
9e0e67918f
1 changed files with 14 additions and 21 deletions
|
@ -52,6 +52,8 @@ class AltTextManager {
|
|||
|
||||
#container;
|
||||
|
||||
#telemetryData = null;
|
||||
|
||||
constructor(
|
||||
{
|
||||
dialog,
|
||||
|
@ -76,7 +78,7 @@ class AltTextManager {
|
|||
this.#container = container;
|
||||
|
||||
dialog.addEventListener("close", this.#close.bind(this));
|
||||
cancelButton.addEventListener("click", this.#cancel.bind(this));
|
||||
cancelButton.addEventListener("click", this.#finish.bind(this));
|
||||
saveButton.addEventListener("click", this.#save.bind(this));
|
||||
optionDescription.addEventListener("change", this.#boundUpdateUIState);
|
||||
optionDecorative.addEventListener("change", this.#boundUpdateUIState);
|
||||
|
@ -240,22 +242,20 @@ class AltTextManager {
|
|||
}
|
||||
}
|
||||
|
||||
#cancel() {
|
||||
#close() {
|
||||
this.#eventBus.dispatch("reporttelemetry", {
|
||||
source: this,
|
||||
details: {
|
||||
type: "editing",
|
||||
subtype: this.#currentEditor.editorType,
|
||||
data: {
|
||||
data: this.#telemetryData || {
|
||||
action: "alt_text_cancel",
|
||||
alt_text_keyboard: !this.#hasUsedPointer,
|
||||
},
|
||||
},
|
||||
});
|
||||
this.#finish();
|
||||
}
|
||||
this.#telemetryData = null;
|
||||
|
||||
#close() {
|
||||
this.#removeOnClickListeners();
|
||||
this.#uiManager?.addEditListeners();
|
||||
this.#eventBus._off("resize", this.#boundSetPosition);
|
||||
|
@ -274,21 +274,14 @@ class AltTextManager {
|
|||
altText,
|
||||
decorative,
|
||||
};
|
||||
this.#eventBus.dispatch("reporttelemetry", {
|
||||
source: this,
|
||||
details: {
|
||||
type: "editing",
|
||||
subtype: this.#currentEditor.editorType,
|
||||
data: {
|
||||
action: "alt_text_save",
|
||||
alt_text_description: !!altText,
|
||||
alt_text_edit:
|
||||
!!this.#previousAltText && this.#previousAltText !== altText,
|
||||
alt_text_decorative: decorative,
|
||||
alt_text_keyboard: !this.#hasUsedPointer,
|
||||
},
|
||||
},
|
||||
});
|
||||
this.#telemetryData = {
|
||||
action: "alt_text_save",
|
||||
alt_text_description: !!altText,
|
||||
alt_text_edit:
|
||||
!!this.#previousAltText && this.#previousAltText !== altText,
|
||||
alt_text_decorative: decorative,
|
||||
alt_text_keyboard: !this.#hasUsedPointer,
|
||||
};
|
||||
this.#finish();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue