From fa2489379a975354eb0c84c2510c8dbb985c4476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 6 Jul 2023 15:55:44 +0000 Subject: [PATCH] [FIX] mail: no flicker on showing jump present at specific threshold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/mail/static/src/core/common/thread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/common/thread.js b/addons/mail/static/src/core/common/thread.js index 8597889378c..da4aef35ae9 100644 --- a/addons/mail/static/src/core/common/thread.js +++ b/addons/mail/static/src/core/common/thread.js @@ -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() {