Commit a06f8385 authored by dpapad's avatar dpapad Committed by Commit Bot

MD Settings: Fix avatar selector grid arrow keystrokes in RTL mode.

Bug: 739631
Change-Id: Iecabaae34cd2e20124a5721d65bb8ab92460acf5
Reviewed-on: https://chromium-review.googlesource.com/569181Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486239}
parent 9d704fa8
...@@ -99,6 +99,20 @@ cr.define('cr_profile_avatar_selector', function() { ...@@ -99,6 +99,20 @@ cr.define('cr_profile_avatar_selector', function() {
MockInteractions.keyDownOn(items[0], 39, 'shift', 'ArrowRight'); MockInteractions.keyDownOn(items[0], 39, 'shift', 'ArrowRight');
assertTrue(items[0].focused); assertTrue(items[0].focused);
// Test RTL case.
selector.dir = 'rtl';
MockInteractions.keyDownOn(items[0], 37, [], 'ArrowLeft');
assertTrue(items[1].focused);
MockInteractions.keyDownOn(items[0], 37, [], 'ArrowLeft');
assertTrue(items[2].focused);
MockInteractions.keyDownOn(items[0], 37, [], 'ArrowRight');
assertTrue(items[1].focused);
MockInteractions.keyDownOn(items[0], 37, [], 'ArrowRight');
assertTrue(items[0].focused);
}); });
}); });
} }
......
...@@ -80,6 +80,8 @@ Polymer({ ...@@ -80,6 +80,8 @@ Polymer({
// end. // end.
} }
} else { } else {
if (style.direction == 'rtl')
offset *= -1;
var nextIndex = (focusIndex + offset) % items.length; var nextIndex = (focusIndex + offset) % items.length;
if (nextIndex < 0) if (nextIndex < 0)
nextIndex = items.length - 1; nextIndex = items.length - 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