Commit 8c021bb7 authored by Roman Arora's avatar Roman Arora Committed by Josip Sokcevic

Tab Search: Scroll animation bug fix

Fix scroll bug on repeated quick press of up/down keys on first/last
selector entries.

Fixed: 1110505
Change-Id: I84c015cfd21c6b8c8dd477dcd327ef23e09012ae
Reviewed-on: https://chrome-internal-review.googlesource.com/c/chrome/browser/resources/tab_search/+/3201593Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarTom Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819576}
parent 40c92a47
...@@ -188,14 +188,16 @@ export class TabSearchAppElement extends PolymerElement { ...@@ -188,14 +188,16 @@ export class TabSearchAppElement extends PolymerElement {
// Ensure the scroll view can fully display a preceding or following tab // Ensure the scroll view can fully display a preceding or following tab
// item if existing. Use Math.sign to identify any such preceding or // item if existing. Use Math.sign to identify any such preceding or
// following item. // following item.
const scrollToIndex = if (this.selectedIndex_ === 0 ||
(this.selectedIndex_ === 0 || this.selectedIndex_ === this.filteredOpenTabs_.length - 1) {
this.selectedIndex_ === this.filteredOpenTabs_.length - 1) ? this.getTabSearchItem_(this.selectedIndex_).scrollIntoView({
this.selectedIndex_ : behavior: 'smooth'
this.selectedIndex_ + Math.sign(offset); });
} else {
this.getTabSearchItem_(scrollToIndex) this.getTabSearchItem_(this.selectedIndex_ + Math.sign(offset))
.scrollIntoView({behavior: 'smooth', block: 'nearest'}); .scrollIntoView(
{behavior: 'smooth', block: offset > 0 ? 'end' : 'start'});
}
} }
} }
......
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