Closed Bug 1919122 Opened 5 months ago Closed 2 months ago

panel-item should support disabled attribute

Categories

(Toolkit :: UI Widgets, defect, P3)

defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: mstriemer, Assigned: akulyk)

References

Details

(Whiteboard: [recomp])

Attachments

(1 file)

In bug 1918541 we noticed that the panel-item does not support the disabled attribute. This would help with any issues upgrading the component and would be more consistent with how elements are normally disabled

This snippet could be used as a starting point

--- a/toolkit/content/widgets/panel-list/panel-list.js
+++ b/toolkit/content/widgets/panel-list/panel-list.js
@@ -600,7 +600,7 @@
     #defaultSlot;
 
     static get observedAttributes() {
-      return ["accesskey", "type"];
+      return ["accesskey", "type", "disabled"];
     }
 
     constructor() {
@@ -742,7 +742,7 @@
         } else {
           this._accessKey = null;
         }
-      } else if (name === "type") {
+      } else if (name === "type" || name === "disabled") {
         this.#setButtonAttributes();
       }
     }
@@ -755,6 +755,7 @@
         this.button.setAttribute("role", "menuitem");
         this.button.removeAttribute("aria-checked");
       }
+      this.button.toggleAttribute("disabled", this.disabled);
     }
 
     #setLabelContents() {
@@ -772,11 +773,12 @@
     }
 
     get disabled() {
-      return this.button.hasAttribute("disabled");
+      return this.hasAttribute("disabled");
     }
 
     set disabled(val) {
-      this.button.toggleAttribute("disabled", val);
+      this.toggleAttribute("disabled", val);
+      this.#setButtonAttributes();
     }
 
     get checked() {
Assignee: nobody → akulyk
Attachment #9444212 - Attachment description: WIP: Bug 1919122 - panel-item should support disabled attribute r=#recomp-reviewers → Bug 1919122 - panel-item should support disabled attribute r=#recomp-reviewers
Blocks: 1938491
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4ed604653424 panel-item should support disabled attribute r=reusable-components-reviewers,credential-management-reviewers,hjones,mtigley
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: