[FIX] mail: no flicker on showing jump present at specific threshold

Before this commit, when scrolling down on a long chatter,
there was a specific scroll position that indefinitely
shows & hides "Jump to present" with an infinite flicker.

This happens because visibility of "Jump to present" affects
`scrollHeight`, and the threshold to show/hide this bar was
exactly the same, at 2500px. So when at exactly 2500px,
the bar is shown, but then the distance to present becomes
less than 2500px (because the bar is sticky and pushes the
present down), therefore it must be hidden. But hiding it,
the present moves up, so distance is 2500px again, etc.

This commit fixes the issue by having a 200px tolerance:
- more than 2500px: show "jump to present"
- less than 2300px: do not show "jump to present"

As the "Jump to present" bar is less than 200px height,
there's no risk to indefinitely change its visibility.

closes odoo/odoo#127829

X-original-commit: b1205a90dccc44e6cc7d5fd869cab34a63a4db2c
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-07-07 20:24:53 +02:00
parent acc638f80a
commit fa2489379a
+1 -1
View File
@@ -159,7 +159,7 @@ export class Thread extends Component {
}
get PRESENT_THRESHOLD() {
return PRESENT_THRESHOLD;
return this.state.showJumpPresent ? PRESENT_THRESHOLD - 200 : PRESENT_THRESHOLD;
}
updateShowJumpPresent() {