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

Fix side scroll in linear synteny view causing the browser "back" action #4426

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Jun 6, 2024

Using the side scroll in the center area of the linear synteny view is useful, but can trigger the native browser 'back' and 'forward' history actions, which we don't want. This switches the react onWheel handler for a global event handler to properly disable the onWheel behavior because react event handlers can not event.preventDefault() [1]

[1] "React binds all events at the root element (not the document), and the wheel event is binded internally using true option, and I quote MDN:

A Boolean that, if true, indicates that the function specified by listener will never call preventDefault(). If a passive listener does call preventDefault(), the user agent will do nothing other than generate a console warning" https://stackoverflow.com/questions/57358640/cancel-wheel-event-with-e-preventdefault-in-react-event-bubbling

@cmdcolin cmdcolin changed the title Avoid back action with wheel scroll in the linear synteny view Avoid browser native back action with wheel side scroll in linear synteny view Jun 6, 2024
@cmdcolin cmdcolin merged commit 81777b4 into main Jun 6, 2024
10 checks passed
@cmdcolin cmdcolin deleted the avoid_wheel_back branch June 6, 2024 02:28
@cmdcolin cmdcolin added the bug Something isn't working label Jun 17, 2024
@cmdcolin cmdcolin changed the title Avoid browser native back action with wheel side scroll in linear synteny view Fix side scroll in linear synteny view causing the browser "back" action Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant