onScroll doesn't emit when user is scrolling
See original GitHub issueUser 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
- attach event listener with
terminal.onScroll()
- scroll the terminal using the mouse
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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:The event doesn’t fire as expected and my panes keep splitting.