mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 05:02:41 +08:00
FIX: Cleaned up horizontal nav scrolling so arrows show/hide properly (#30621)
This commit is contained in:
parent
4f9359d056
commit
a88c86beef
|
@ -47,14 +47,21 @@ export default class HorizontalOverflowNav extends Component {
|
|||
}
|
||||
|
||||
watchScroll(element) {
|
||||
if (element.offsetWidth + element.scrollLeft === element.scrollWidth) {
|
||||
const { scrollWidth, scrollLeft, offsetWidth } = element;
|
||||
|
||||
// Check if the content overflows
|
||||
this.hasScroll = scrollWidth > offsetWidth;
|
||||
|
||||
// Ensure the right arrow disappears only when fully scrolled
|
||||
if (scrollWidth - scrollLeft - offsetWidth <= 2) {
|
||||
this.hideRightScroll = true;
|
||||
clearInterval(this.scrollInterval);
|
||||
} else {
|
||||
this.hideRightScroll = false;
|
||||
}
|
||||
|
||||
if (element.scrollLeft === 0) {
|
||||
// Ensure the left arrow disappears only when fully scrolled to the start
|
||||
if (scrollLeft <= 2) {
|
||||
this.hideLeftScroll = true;
|
||||
clearInterval(this.scrollInterval);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user