Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js

Issue 2655393003: DevTools: Introduce ARIAUtils (Closed)
Patch Set: setAccessibleName in InspectorView Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 UI.ARIAUtils = {};
6
7 /**
8 * @param {!Element} element
9 */
10 UI.ARIAUtils.markAsTab = function(element) {
11 element.setAttribute('role', 'tab');
12 };
13
14 /**
15 * @param {!Element} element
16 * @param {boolean} value
17 */
18 UI.ARIAUtils.setSelected = function(element, value) {
19 // aria-selected behaves differently for false and undefined.
20 // Often times undefined values are unintentionally typed as booleans.
21 // Use !! to make sure this is true or false.
22 element.setAttribute('aria-selected', !!value);
23 };
24
25 /**
26 * @param {!Element} element
27 * @param {boolean} value
28 */
29 UI.ARIAUtils.setPressed = function(element, value) {
30 // aria-pressed behaves differently for false and undefined.
31 // Often times undefined values are unintentionally typed as booleans.
32 // Use !! to make sure this is true or false.
33 element.setAttribute('aria-pressed', !!value);
34 };
35
36 /**
37 * @param {!Element} element
38 * @param {string} name
39 */
40 UI.ARIAUtils.setAccessibleName = function(element, name) {
41 element.setAttribute('aria-label', name);
42 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698