Skip to content

Commit c2dd50c

Browse files
committed
Bug: tab-preview-panel fires popupshown twice but popuphidden once
When hovering Tab A then quickly moving to Tab B while Tab A's preview panel is still in the "showing" state, moveToAnchor() re-triggers the popup lifecycle. The popupshowing listener from Tab A's activation is still registered, causing a duplicate popupshown event. Only one popuphidden fires when the panel finally closes. This causes Firefox's own sidebar _hoverBlockerCount to get stuck (2 increments, 1 decrement), permanently preventing sidebar autohide from working. Fix: remove the stale popupshowing listener when re-activating on a different tab while the panel is in "showing" or "open" state.
1 parent 6925ce3 commit c2dd50c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

browser/components/tabbrowser/content/tab-hover-preview.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ class TabPanel extends HoverPanel {
393393
this.panelElement.state == "open" ||
394394
this.panelElement.state == "showing"
395395
) {
396+
// Remove stale listener from previous activation to prevent
397+
// duplicate popupshown events when moveToAnchor re-triggers
398+
// the popup lifecycle during the "showing" state.
399+
this.panelElement.removeEventListener("popupshowing", this);
396400
this.#updatePreview();
397401
} else {
398402
this.panelSet.panelOpener.execute(() => {

0 commit comments

Comments
 (0)