Minor bug in reply button

Vavien

Member
Affected version
2.3
I realized the odd behaviour of reply button. Checked the code and found the reason.

Problem: It scrools weird. Click it a few times in a row. Try that in a XF 2.2 website. It shouldn't be like that.

Solution: in message.js, in XF.QuoteClick, theres a line like this.
Code:
window.scrollTo({ top: qr.getBoundingClientRect().top - XF.getStickyHeaderOffset() })

It was like this in XF 2.2 and you converted into that. An acceptable mistake.
Code:
window.scrollTo({ top: $qr.offset().top - XF.getStickyHeaderOffset() });

It should be something like this.
Code:
window.scrollTo({ top: qr.getBoundingClientRect().top + window.scrollY - XF.getStickyHeaderOffset() })

But even with that, there's still a problem. XF.getStickyHeaderOffset() returns 0 when it's not in sticky mode or whatever you call. But if it's not a long message, a user can see and click reply button when it's not sticky. So it's a bit off if you're at top of the page. Maybe put a parameter not to check if is has the is-sticky class or just use qr.scrollIntoView(). Seems like doing the same, unlike some other websites that scrolls under the sticky navbar.

By the way, I'd prefer window.scroll() because of this.
When the scrollTo() method is invoked, the user agent must act as if the scroll() method was invoked with the same arguments.
 
Last edited:
Back
Top Bottom