Changeset 258730 in webkit


Ignore:
Timestamp:
Mar 19, 2020 2:41:33 PM (4 years ago)
Author:
Nikita Vasilyev
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):

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r258729 r258730  
     12020-03-19  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: AXI: disabled buttons shouldn't be focusable
     4        https://bugs.webkit.org/show_bug.cgi?id=208283
     5        <rdar://problem/59832150>
     6
     7        Reviewed by Devin Rousso.
     8
     9        Set tabIndex to "-1" when button becomes disabled.
     10
     11        * UserInterface/Views/ActivateButtonNavigationItem.js:
     12        (WI.ActivateButtonNavigationItem):
     13        * UserInterface/Views/ButtonNavigationItem.js:
     14        `_role` is defined in the parent class now.
     15
     16        (WI.ButtonNavigationItem):
     17        (WI.ButtonNavigationItem.prototype.set enabled):
     18        (WI.ButtonNavigationItem.prototype.get tabbable):
     19        (WI.ButtonNavigationItem.prototype._updateTabIndex):
     20        * UserInterface/Views/RadioButtonNavigationItem.js:
     21        (WI.RadioButtonNavigationItem.prototype.get tabbable):
     22        (WI.RadioButtonNavigationItem):
     23
    1242020-03-19  Nikita Vasilyev  <nvasilyev@apple.com>
    225
  • trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js

    r257411 r258730  
    3232        this._defaultToolTip = defaultToolTip;
    3333        this._activatedToolTip = activatedToolTip || defaultToolTip;
    34         this._role = role;
    3534    }
    3635
  • trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js

    r257759 r258730  
    4141        this.element.addEventListener("mousedown", this._handleMouseDown.bind(this), true);
    4242
    43         if (role === "button") {
    44             this.element.tabIndex = 0;
     43        this._role = role;
     44        if (this._role === "button")
    4545            this.element.addEventListener("keydown", this._handleKeyDown.bind(this));
    46         }
    4746
    4847        if (label)
     
    5655        this._label = toolTipOrLabel;
    5756
     57        this._updateTabIndex();
     58
    5859        this.buttonStyle = this._image ? WI.ButtonNavigationItem.Style.Image : WI.ButtonNavigationItem.Style.Text;
    5960
     
    112113        this._enabled = flag;
    113114        this.element.classList.toggle("disabled", !this._enabled);
     115        this.element.ariaDisabled = !this._enabled;
     116
     117        this._updateTabIndex();
    114118    }
    115119
     
    169173    {
    170174        return ["button"];
     175    }
     176
     177    get tabbable()
     178    {
     179        return this._role === "button";
    171180    }
    172181
     
    229238        }
    230239    }
     240
     241    _updateTabIndex()
     242    {
     243        if (!this._enabled) {
     244            this.element.tabIndex = -1;
     245            return;
     246        }
     247
     248        this.element.tabIndex = this.tabbable ? 0 : -1;
     249    }
    231250};
    232251
  • trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js

    r256652 r258730  
    6767        return ["radio", "button"];
    6868    }
     69
     70    get tabbable()
     71    {
     72        return this.selected ? 0 : -1;
     73    }
    6974};
    7075
Note: See TracChangeset for help on using the changeset viewer.