Skip to content

Commit

Permalink
Show tab preview panel correctly for container tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Nov 30, 2024
1 parent 63613f7 commit 5ed7279
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions webextensions/sidebar/tab-preview-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,12 @@ async function onTabSubstanceEnter(event) {
false :
window.mozInnerScreenX - window.screenX > (window.outerWidth - window.innerWidth) / 2;

const hasCustomTooltip = tooltipText != event.target.tab.$TST.defaultTooltipText;
const hasPreview = (
!active &&
!event.target.tab.discarded &&
CAPTURABLE_URLS_MATCHER.test(event.target.tab.url) &&
tooltipText == event.target.tab.$TST.defaultTooltipText
!hasCustomTooltip
);

let succeeded = await sendTabPreviewMessage(targetTabId, {
Expand All @@ -381,11 +382,16 @@ async function onTabSubstanceEnter(event) {
offsetLeft: window.mozInnerScreenX - window.screenX,
align: mayBeRight ? 'right' : 'left',
scale: 1 / window.devicePixelRatio,
active,
title: event.target.tab.title,
url,
tooltipText,
tooltipHtml,
...(hasCustomTooltip ?
{
tooltipText,
tooltipHtml,
} :
{
title: event.target.tab.title,
url,
}
),
hasPreview,
timestamp: startAt, // Don't call Date.now() here, because it can become larger than the timestamp on mouseleave.
canRetry: !!targetTabId,
Expand Down

0 comments on commit 5ed7279

Please sign in to comment.