Skip to content

Commit

Permalink
Prevent reflow when selecting section
Browse files Browse the repository at this point in the history
Selecting the section after a pan-zoom hotspot had been selected,
caused the pan-zoom animation to stay stuck in Firefox instead of
reverting to the initial step.

The `mousedown` on the section triggers both the selection change and
the `onDismiss` callback of the floating tooltip that is supposed to
scroll the hotspots scroller back to the first position.

When the section is selected, we toggle a `selected` CSS class on the
section to display a selection rect made of pseudo elements. Toggling
these pseudo elements causes a reflow that makes Firefox drop the
`scroll` event that would have been triggered by scrolling the
hotspots scroller.

The scroll timeline polyfill then has no opportunity to refresh the
position of the hotspots image causing it to stay stuck.

REDMINE-20673
  • Loading branch information
tf authored and DanielKuhn committed Oct 9, 2024
1 parent b874cca commit 0ffe4fa
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
position: relative;
}

.highlighted > section::before,
.lineAbove > section::before,
.lineBelow > section::before,
.selected > section::before {
section::before {
content: "";
display: block;
position: absolute;
Expand All @@ -15,6 +12,14 @@
bottom: 6px;
z-index: 9;
pointer-events: none;
visibility: hidden;
}

.highlighted > section::before,
.lineAbove > section::before,
.lineBelow > section::before,
.selected > section::before {
visibility: visible;
}

.highlighted > section::before,
Expand Down

0 comments on commit 0ffe4fa

Please sign in to comment.