| Index: ui/webui/resources/js/cr/ui/focus_row.js
|
| diff --git a/ui/webui/resources/js/cr/ui/focus_row.js b/ui/webui/resources/js/cr/ui/focus_row.js
|
| index 3006d640075dee45c262a6c94f09b3c836039c2c..1065c0aa3e88a955c957eb7114ba418271b5457f 100644
|
| --- a/ui/webui/resources/js/cr/ui/focus_row.js
|
| +++ b/ui/webui/resources/js/cr/ui/focus_row.js
|
| @@ -57,6 +57,24 @@ cr.define('cr.ui', function() {
|
| /** @const {string} */
|
| FocusRow.ACTIVE_CLASS = 'focus-row-active';
|
|
|
| + /**
|
| + * Whether it's possible that |element| can be focused.
|
| + * @param {Element} element
|
| + * @return {boolean} Whether the item is focusable.
|
| + */
|
| + FocusRow.isFocusable = function isFocusable(element) {
|
| + if (!element)
|
| + return false;
|
| +
|
| + // Hidden elements are not focusable.
|
| + var style = window.getComputedStyle(element);
|
| + if (style.visibility == 'hidden' || style.display == 'none')
|
| + return false;
|
| +
|
| + // Verify all ancestors are focusable.
|
| + return !element.parentElement || isFocusable(element.parentElement);
|
| + };
|
| +
|
| FocusRow.prototype = {
|
| __proto__: HTMLDivElement.prototype,
|
|
|
|
|