From 6cb7b9f3c94dd35d33299b184719930429ca4315 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Wed, 9 Mar 2016 14:44:32 -0500 Subject: [PATCH] Ignore titles in menu, if they exist. This is because of the change in #3163 where we added the title as an item in the childrens array so that it is ordered correctly but this breaks keyboard support because they expect the children to be lined up correctly and also because they expect the children to be component objects with an 'el_' property. Checking to see if the first item is a 'vjs-menu-title' and adding one to the 'item' allows us to ignore the title element and also select the actual menu items. --- src/js/menu/menu.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/js/menu/menu.js b/src/js/menu/menu.js index 1fa9923a2f..82e43bd543 100644 --- a/src/js/menu/menu.js +++ b/src/js/menu/menu.js @@ -126,6 +126,13 @@ class Menu extends Component { item = children.length - 1; } + let haveTitle = children[0].className && + /vjs-menu-title/.test(children[0].className); + + if (item === 0 && haveTitle) { + item = 1; + } + this.focusedChild_ = item; children[item].el_.focus();