Title: [258730] trunk/Source/WebInspectorUI
Revision
258730
Author
nvasil...@apple.com
Date
2020-03-19 14:41:33 -0700 (Thu, 19 Mar 2020)

Log Message

Web Inspector: AXI: disabled buttons shouldn't be focusable
https://bugs.webkit.org/show_bug.cgi?id=208283
<rdar://problem/59832150>

Reviewed by Devin Rousso.

Set tabIndex to "-1" when button becomes disabled.

* UserInterface/Views/ActivateButtonNavigationItem.js:
(WI.ActivateButtonNavigationItem):
* UserInterface/Views/ButtonNavigationItem.js:
`_role` is defined in the parent class now.

(WI.ButtonNavigationItem):
(WI.ButtonNavigationItem.prototype.set enabled):
(WI.ButtonNavigationItem.prototype.get tabbable):
(WI.ButtonNavigationItem.prototype._updateTabIndex):
* UserInterface/Views/RadioButtonNavigationItem.js:
(WI.RadioButtonNavigationItem.prototype.get tabbable):
(WI.RadioButtonNavigationItem):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (258729 => 258730)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-03-19 21:35:47 UTC (rev 258729)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-03-19 21:41:33 UTC (rev 258730)
@@ -1,5 +1,28 @@
 2020-03-19  Nikita Vasilyev  <nvasil...@apple.com>
 
+        Web Inspector: AXI: disabled buttons shouldn't be focusable
+        https://bugs.webkit.org/show_bug.cgi?id=208283
+        <rdar://problem/59832150>
+
+        Reviewed by Devin Rousso.
+
+        Set tabIndex to "-1" when button becomes disabled.
+
+        * UserInterface/Views/ActivateButtonNavigationItem.js:
+        (WI.ActivateButtonNavigationItem):
+        * UserInterface/Views/ButtonNavigationItem.js:
+        `_role` is defined in the parent class now.
+
+        (WI.ButtonNavigationItem):
+        (WI.ButtonNavigationItem.prototype.set enabled):
+        (WI.ButtonNavigationItem.prototype.get tabbable):
+        (WI.ButtonNavigationItem.prototype._updateTabIndex):
+        * UserInterface/Views/RadioButtonNavigationItem.js:
+        (WI.RadioButtonNavigationItem.prototype.get tabbable):
+        (WI.RadioButtonNavigationItem):
+
+2020-03-19  Nikita Vasilyev  <nvasil...@apple.com>
+
         Web Inspector: remove redundant code in TreeOutline.prototype.removeChildAtIndex
         https://bugs.webkit.org/show_bug.cgi?id=209301
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js (258729 => 258730)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js	2020-03-19 21:35:47 UTC (rev 258729)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js	2020-03-19 21:41:33 UTC (rev 258730)
@@ -31,7 +31,6 @@
 
         this._defaultToolTip = defaultToolTip;
         this._activatedToolTip = activatedToolTip || defaultToolTip;
-        this._role = role;
     }
 
     // Public

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js (258729 => 258730)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js	2020-03-19 21:35:47 UTC (rev 258729)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js	2020-03-19 21:41:33 UTC (rev 258730)
@@ -40,10 +40,9 @@
         // Don't move the focus on the button when clicking on it. This matches macOS behavior.
         this.element.addEventListener("mousedown", this._handleMouseDown.bind(this), true);
 
-        if (role === "button") {
-            this.element.tabIndex = 0;
+        this._role = role;
+        if (this._role === "button")
             this.element.addEventListener("keydown", this._handleKeyDown.bind(this));
-        }
 
         if (label)
             this.element.setAttribute("aria-label", label);
@@ -55,6 +54,8 @@
         this._imageHeight = imageHeight || 16;
         this._label = toolTipOrLabel;
 
+        this._updateTabIndex();
+
         this.buttonStyle = this._image ? WI.ButtonNavigationItem.Style.Image : WI.ButtonNavigationItem.Style.Text;
 
         this.imageType = this._image ? WI.ButtonNavigationItem.ImageType.SVG : null;
@@ -111,6 +112,9 @@
 
         this._enabled = flag;
         this.element.classList.toggle("disabled", !this._enabled);
+        this.element.ariaDisabled = !this._enabled;
+
+        this._updateTabIndex();
     }
 
     get buttonStyle()
@@ -170,6 +174,11 @@
         return ["button"];
     }
 
+    get tabbable()
+    {
+        return this._role === "button";
+    }
+
     // Private
 
     _mouseClicked(event)
@@ -228,6 +237,16 @@
             }
         }
     }
+
+    _updateTabIndex()
+    {
+        if (!this._enabled) {
+            this.element.tabIndex = -1;
+            return;
+        }
+
+        this.element.tabIndex = this.tabbable ? 0 : -1;
+    }
 };
 
 WI.ButtonNavigationItem.Event = {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js (258729 => 258730)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js	2020-03-19 21:35:47 UTC (rev 258729)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js	2020-03-19 21:41:33 UTC (rev 258730)
@@ -66,6 +66,11 @@
     {
         return ["radio", "button"];
     }
+
+    get tabbable()
+    {
+        return this.selected ? 0 : -1;
+    }
 };
 
 WI.RadioButtonNavigationItem.StyleClassName = "radio";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to