Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message list not vertically scrolling while mouse over horizontal scrollable code blocks (#7497) is fixed [Duplicate for vertical scroll hotfix] #9026

Merged
merged 5 commits into from
May 18, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class PreRenderer extends React.Component {
scrollNode(event) {
const node = this.ref.getScrollableNode();
const horizontalOverflow = node.scrollWidth > node.offsetWidth;

if ((event.currentTarget === node) && horizontalOverflow) {
const isVerticalScrolling = Math.abs(event.deltaY) > 3; // This is for touchpads sensitive
if ((event.currentTarget === node) && horizontalOverflow && !isVerticalScrolling) {
Comment on lines +35 to +36
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isVerticalScrolling = Math.abs(event.deltaY) > 3; // This is for touchpads sensitive
if ((event.currentTarget === node) && horizontalOverflow && !isVerticalScrolling) {
if ((event.currentTarget === node) && horizontalOverflow && event.deltaX !== 0) {

What if only do this? What benefit do we get from checking scroll sensitivity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@parasharrajat Because even if the user scrolls horizontally while scrolling with two fingers on the touchpads, the fingers may go up a little during that scroll, and the page will start to scroll vertically due to this going up. With this sensitive i eliminated this bug.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, let me test this behavior.

Copy link
Contributor Author

@orkunkarakus orkunkarakus May 16, 2022

Choose a reason for hiding this comment

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

@parasharrajat and if we only do this event.deltaX !== 0 the scroll will not be smooth. Tested on touchpad.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I tested it. Looking fine to me. Add a comment instead This is for touchpads sensitive like you did https://github.com/Expensify/App/pull/9026/files#r873936354

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@parasharrajat More detailed comment added. PR is ready 👍

node.scrollLeft += event.deltaX;
event.preventDefault();
event.stopPropagation();
Expand Down