Commit 217a0ab2 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Files app: Fix keyboard shortcut Alt+A

Fix the selector to be able to reach to <button> or <cr-button> in the
toolbar.

Bug: 1035691
Change-Id: I75ddda33c00914c049d048209e1d21cf761b4758
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094063
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748135}
parent 6d2a7ddb
......@@ -455,6 +455,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("toolbarDeleteEntry").InGuestMode(),
TestCase("toolbarDeleteEntry"),
TestCase("toolbarRefreshButtonWithSelection").EnableArc(),
TestCase("toolbarAltACommand").FilesNg(),
TestCase("toolbarRefreshButtonHiddenInRecents")));
WRAPPED_INSTANTIATE_TEST_SUITE_P(
......
......@@ -2374,7 +2374,9 @@ CommandHandler.COMMANDS_['open-gear-menu'] = new class extends Command {
*/
CommandHandler.COMMANDS_['focus-action-bar'] = new class extends Command {
execute(event, fileManager) {
fileManager.ui.actionbar.querySelector('button:not([hidden])').focus();
fileManager.ui.actionbar
.querySelector('button:not([hidden]), cr-button:not([hidden])')
.focus();
}
};
......
......@@ -124,3 +124,22 @@ testcase.toolbarRefreshButtonHiddenInRecents = async () => {
// Check that the button should be hidden.
await remoteCall.waitForElement(appId, '#refresh-button[hidden]');
};
/**
* Tests that command Alt+A focus the toolbar.
*/
testcase.toolbarAltACommand = async () => {
// Open files app.
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.beautiful], []);
// Press Alt+A in the File List.
const altA = ['#file-list', 'a', false, false, true];
await remoteCall.fakeKeyDown(appId, ...altA);
// Check that a menu-button should be focused.
const focusedElement =
await remoteCall.callRemoteTestUtil('getActiveElement', appId, []);
const cssClasses = focusedElement.attributes['class'] || '';
chrome.test.assertTrue(cssClasses.includes('menu-button'));
};
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