question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onScroll doesn't emit when user is scrolling

See original GitHub issue

User scrolling is currently not emitted as an onScroll event. What’s the reason for this? Is this really intended? I’d like to monitor the scroll state of the terminal in order to notice when it’s scrolled all the way down, so I have to notice when the user is scrolling, which is not possible with the current behavior.

Details

  • Browser and browser version: Firefox 84.0.1
  • xterm.js version: 4.9.0

Steps to reproduce

  1. attach event listener with terminal.onScroll()
  2. scroll the terminal using the mouse

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Tyriarcommented, Apr 1, 2021

Looking over this change and re-reading the description, this seems more like a bug and I say we include it in a minor release. It looks like it might also fix an internal bug since this should clear when any user scroll happens:

https://github.com/schrej/xterm.js/blob/1925f1f442132919e109fdce21f6d30f8053c471/src/browser/Terminal.ts#L517-L517

I’ll leave the breaking change label to call it out in the release notes.

0reactions
daonbcommented, Feb 25, 2021

I need a onScrollBuffer, here’s my use case.

I’m developing a touchable terminal multiplexer where the user can use the cut gesture to split the pane. My app can split both right-to-left and top-to-bottom. When a user scrolls fast the latter is firing unintentionally.

To solve this I added code to disable vertical splitting for 2 seconds after the user scrolls. I’ve tried using onScroll in my code as according to the docs it does just what I need:

Adds an event listener for when a scroll occurs. The event value is the new position of the viewport.

The event doesn’t fire as expected and my panes keep splitting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript Scroll Handler not firing - Stack Overflow
MY problem is that the scroll handler never gets called. If I replace the scroll to click , it works when I click....
Read more >
Document: scroll event - Web APIs - MDN Web Docs - Mozilla
The scroll event fires when the document view has been scrolled. To detect when scrolling has completed, see the Document: scrollend event.
Read more >
Scrolling - The Modern JavaScript Tutorial
Load more data when the user scrolls down till the end of the page. Here's a small function to show the current scroll:...
Read more >
JavaScript Scroll Events, Event Throttling & Passive Events
Many scroll events fire while you are scrolling a page or an element. If you attach an event listener to the scroll event,...
Read more >
The “scroll” event JavaScript Tutorial | window.onscroll
Learn about JavaScript's scroll event in this coding tutorial. I show you two ways to listen to scroll events and talk about why...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found