Skip to content

Conversation

@softwarenerd
Copy link
Contributor

@softwarenerd softwarenerd commented Sep 29, 2025

Description

This PR addresses #3755. The fix was to remove the code in Data Grid that inverted deltaX and deltaY when the shift key is pressed during wheel events. It is unnecessary code.

Trackpads already have gestures for scrolling vertically and scrolling horizontally, so shift key inversion isn't necessary for wheel events that come from a trackpad.

By the time a React onWheel handler runs, the deltaX and deltaY values are already inverted by the browser engine when the event comes from a mouse and the shift key is down.

So this code:

// When the user is holding the shift key, invert delta X and delta Y.
if (e.shiftKey) {
	[deltaX, deltaY] = [deltaY, deltaX];
}

was causing a double inversion of deltaX and deltaY for mouse-initiated wheel events.

(*And, there is no way in a React onWheel event handler to tell whether the event came from a trackpad or a mouse.)

Release Notes

New Features

  • N/A

Bug Fixes

QA Notes

  • None

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes mouse wheel handling in the Data Explorer component by removing unnecessary deltaX/deltaY inversion logic when the shift key is pressed. The browser already handles this inversion automatically, so the custom code was causing double inversion for mouse wheel events.

Key Changes

  • Removed shift key delta inversion logic from wheel event handler
  • Preserved existing alt key scroll amplification behavior

@github-actions
Copy link

github-actions bot commented Sep 29, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working great for me, and it's really nice to be able to shift horizontally with my scroll wheel! 🙌

@softwarenerd softwarenerd merged commit a9fd9ad into main Sep 30, 2025
22 of 23 checks passed
@softwarenerd softwarenerd deleted the fix/data-grid-wheel-event-handler-shift-key branch September 30, 2025 15:30
@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants