Skip to content

Commit

Permalink
Fix wrong stacking context of hints in some situations
Browse files Browse the repository at this point in the history
  • Loading branch information
david-tejada committed Aug 5, 2023
1 parent 5a2c390 commit 9d13267
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/content/hints/HintClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function calculateZIndex(target: Element, hintOuter: HTMLDivElement) {
let current: Element | null = target;

while (current) {
if (current.contains(hintOuter)) return zIndex;
if (current.contains(hintOuter)) break;

if (createsStackingContext(current)) {
const currentIndex = Number.parseInt(
Expand All @@ -160,7 +160,9 @@ function calculateZIndex(target: Element, hintOuter: HTMLDivElement) {
current = current.parentElement;
}

return zIndex;
// We increase by one to avoid relying on document order because this can be
// altered with the property `order` (only in Firefox).
return zIndex + 1;
}

// This mutation observer takes care of reattaching the hints when they are
Expand Down

0 comments on commit 9d13267

Please sign in to comment.