Commit c10e0f1b authored by Rose Garcia's avatar Rose Garcia Committed by Commit Bot

Connect custom menu order functions.

Use the custom menu order functions to set the order of the buttons in
the menu panel init function. The ability to set the button order is not
user facing but can be done in remote debugging using the updatePositionAttributes_
function.

Tested using emulated Chrome on Linux with flags
--enable-experimental-accessibility-switch-access and
--enable-experimental-accessibility-switch-access-text.
Use of updateButtonOrder function does not impact the order or function of the menu.
Button order can be manipulated manually using the updatePositionAttributes function.

Bug: 994256
Change-Id: If76d9a48d74e738129d9e0788e03c599d6cf6e32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1770432Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Reviewed-by: default avatarAnastasia Helfinstein <anastasi@google.com>
Commit-Queue: Rose Garcia <rosalindag@google.com>
Cr-Commit-Position: refs/heads/master@{#691001}
parent 0a1132f1
...@@ -39,6 +39,11 @@ class Panel { ...@@ -39,6 +39,11 @@ class Panel {
init() { init() {
this.panel_ = document.getElementById(SAConstants.MENU_PANEL_ID); this.panel_ = document.getElementById(SAConstants.MENU_PANEL_ID);
let menuList = Object.values(SAConstants.MenuId);
for (const menuId of menuList) {
this.updateButtonOrder_(menuId);
}
const buttons = document.getElementsByTagName('button'); const buttons = document.getElementsByTagName('button');
for (const button of buttons) { for (const button of buttons) {
this.setupButton_(button); this.setupButton_(button);
...@@ -144,14 +149,14 @@ class Panel { ...@@ -144,14 +149,14 @@ class Panel {
* @param {!Array<string>} buttonOrder * @param {!Array<string>} buttonOrder
* @private * @private
*/ */
updatePositionAttributes_(buttonOrder) { updatePositionAttributes_(buttonOrder, menuId) {
this.menuManager_.exit(); this.menuManager_.exit();
for (let pos = 0; pos < buttonOrder.length; pos++) { for (let pos = 0; pos < buttonOrder.length; pos++) {
let buttonPosition = pos; let buttonPosition = pos;
let button = document.getElementById(buttonOrder[pos]); let button = document.getElementById(buttonOrder[pos]);
button.setAttribute('data-position', String(buttonPosition)); button.setAttribute('data-position', String(buttonPosition));
} }
this.updateButtonOrder_('switchaccess_menu_actions'); this.updateButtonOrder_(menuId);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment