Index: third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..210185ee26134604033e3113224b078d8862cb1f |
--- /dev/null |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
dgozman
2017/01/26 23:21:42
no (c)
einbinder
2017/01/27 00:19:27
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+UI.ARIAUtils = class { |
dgozman
2017/01/26 23:21:42
Are we going to have any logic here? I'm usually n
einbinder
2017/01/27 00:19:27
It is mostly for type checking, and to have an org
|
+ /** |
+ * @param {!Element} element |
+ */ |
+ static makeTab(element) { |
+ element.setAttribute('role', 'tab'); |
+ } |
+ |
+ /** |
+ * @param {!Element} element |
+ * @param {boolean} value |
+ */ |
+ static setSelected(element, value) { |
+ element.setAttribute('aria-selected', !!value); |
dgozman
2017/01/26 23:21:42
Remove !!
einbinder
2017/01/27 00:19:27
We have a lot of bugs with closure where it thinks
|
+ } |
+ |
+ /** |
+ * @param {!Element} element |
+ * @param {boolean} value |
+ */ |
+ static setPressed(element, value) { |
+ element.setAttribute('aria-pressed', !!value); |
aboxhall
2017/01/26 22:47:26
This may not work for all cases. Note that pressed
dgozman
2017/01/26 23:21:42
Remove !!
|
+ } |
+ |
+ /** |
+ * @param {!Element} element |
+ * @param {string} name |
+ */ |
+ static setAccessibleName(element, name) { |
+ element.setAttribute('aria-label', name); |
+ } |
+}; |