Skip to content

Commit

Permalink
Scroll normal tabs if pinned tabs are not scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 8, 2024
1 parent c339980 commit 1ebe3ad
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions webextensions/sidebar/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,15 @@ async function smoothScrollTo(params = {}) {

smoothScrollTo.stopped = false;

const scrollBox = getScrollBoxFor(params.tab);
let scrollBox = params.scrollBox;
if (!scrollBox) {
scrollBox = getScrollBoxFor(params.tab);
if (scrollBox == mPinnedScrollBox &&
scrollBox.$scrollTopMax == 0) {
log('smoothScrollTo: pinned tabs are not scrollable, fallback to normal tabs');
scrollBox = mNormalScrollBox;
}
}

let delta, startPosition, endPosition;
if (params.tab) {
Expand Down Expand Up @@ -758,8 +766,15 @@ async function smoothScrollTo(params = {}) {
smoothScrollTo.currentOffset= 0;

async function smoothScrollBy(delta) {
let scrollBox = getScrollBoxFor(Tab.getActiveTab(TabsStore.getCurrentWindowId()));
if (scrollBox == mPinnedScrollBox &&
scrollBox.$scrollTopMax == 0) {
log('smoothScrollBy: pinned tabs are not scrollable, fallback to normal tabs');
scrollBox = mNormalScrollBox;
}
return smoothScrollTo({
position: getScrollBoxFor(Tab.getActiveTab(TabsStore.getCurrentWindowId())).$scrollTop + delta,
position: scrollBox.$scrollTop + delta,
scrollBox,
});
}

Expand Down

0 comments on commit 1ebe3ad

Please sign in to comment.