smooth-scrollbar icon indicating copy to clipboard operation
smooth-scrollbar copied to clipboard

Add middle mouse button scrolling support

Open Xorcist137 opened this issue 10 months ago • 4 comments

Description

This PR adds support for middle mouse button scrolling (auto-scrolling) that matches native browser behavior:

Users can click the middle mouse button to enter auto-scroll mode Moving the mouse controls scroll direction and speed Any mouse button click or ESC key exits auto-scroll mode Cursor changes to 'all-scroll' during auto-scrolling to indicate the mode Simple distance-based scrolling with a small dead zone for precision

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Added events/middle-button.ts with the implementation Added export in events/index.ts Added enableMiddleMouseScroll option (default: true) in options.ts Updated interfaces/scrollbar.ts with the new option type

Xorcist137 avatar Mar 02 '25 19:03 Xorcist137

Hi @Xorcist137 Thanks for the PR

Could you please record a video of these changes? 🙏

sadeghbarati avatar Mar 02 '25 19:03 sadeghbarati

https://github.com/user-attachments/assets/9576f599-395c-4bcb-be89-ec5f54ee0138

Hi @sadeghbarati , Thanks for taking a look. Here's a short video showcasing the functionality. All it does is replicate the native experience of middle mouse scrolling. Please let me know if you have any changes you would like to see. I'm interested in contributing however I can.

👌

Xorcist137 avatar Mar 02 '25 23:03 Xorcist137

Thank you so much for this PR! 🤗

The code looks good, but I may need a physical mouse to test the functionality later this week.

P.S. I used to think this could be implemented through a plugin XD

idiotWu avatar Mar 10 '25 03:03 idiotWu

@idiotWu could you please give a moment of your attention to this library, also seeing https://github.com/idiotWu/smooth-scrollbar/pull/574?

jpike88 avatar Apr 28 '25 15:04 jpike88