Commit 5ea02023 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Allow shift+tab to move focus within a row that uses FocusRowBehavior.

Previously, shift+tab would move focus out of the whole list instead
of just moving to the previous element within a row.

Bug: 1030825
Change-Id: I11ae0c7c27f308f4de55b7dabf7a3707304e51ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1963440
Commit-Queue: Jon Mann <jonmann@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724488}
parent b121c2e8
......@@ -281,14 +281,24 @@ cr.define('cr.ui', function() {
return;
}
if (hasKeyModifiers(e)) {
const isShiftTab = !e.altKey && !e.ctrlKey && !e.metaKey && e.shiftKey &&
e.key === 'Tab';
if (hasKeyModifiers(e) && !isShiftTab) {
return;
}
let index = -1;
let shouldStopPropagation = true;
if (e.key == 'ArrowLeft') {
if (isShiftTab) {
// This always moves back one element, even in RTL.
index = elementIndex - 1;
if (index < 0) {
// Bubble up to focus on the previous element outside the row.
return;
}
} else if (e.key == 'ArrowLeft') {
index = elementIndex + (isRTL() ? 1 : -1);
} else if (e.key == 'ArrowRight') {
index = elementIndex + (isRTL() ? -1 : 1);
......
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