commit 87bd407c04f0f78563e9ba171651c6b046ab5851
parent 91829d27ad25ed1d66660c3fe6242f9a97b07a13
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Mon, 5 Jan 2026 12:37:13 +0000
Bug 2007958 - Don't bother recomputing menu shortcut key if we haven't been rendered. r=Gijs
My previous patch aligns us more with HTML parser behavior, and it
causes this attribute callback to fire earlier, which in turn causes a
warning in ShortcutUtils because localization of the <key> element
hasn't happened yet.
We don't need to recompute the shortcut before first render tho, so
avoid the warning and the extra work that way.
Differential Revision: https://phabricator.services.mozilla.com/D277696
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/toolkit/content/widgets/menu.js b/toolkit/content/widgets/menu.js
@@ -172,7 +172,7 @@
}
attributeChangedCallback(name, oldValue, newValue) {
- if (name == "acceltext") {
+ if (name == "acceltext" && this.renderedOnce) {
if (this._ignoreAccelTextChange) {
this._ignoreAccelTextChange = false;
} else {
@@ -180,7 +180,7 @@
this._computeAccelTextFromKeyIfNeeded();
}
}
- if (name == "key") {
+ if (name == "key" && this.renderedOnce) {
this._computeAccelTextFromKeyIfNeeded();
}
super.attributeChangedCallback(name, oldValue, newValue);