-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add dummy 'wheel' event handler to enable scroll zoom on safari #7474
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
06c3e7f
add dummy 'wheel' event handler to enable scroll zoom on safari
emilykl e6618c6
move dummy scroll listener to Events.init()
emilykl 3ebf3bd
use conditional chaining instead of if statement
emilykl b142a3d
use newer acorn version for bundling, to support newer JS syntax
emilykl 4a54374
add draftlog
emilykl b5deb4d
Update draftlogs/7474_fix.md
emilykl 76c855d
return to if statement for checking existence of addEventListener
emilykl 72c2269
Revert "use newer acorn version for bundling, to support newer JS syn…
emilykl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix scroll wheel zoom for geo subplots in Safari [#7474](https://github.com/plotly/plotly.js/pull/7474) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the
if
block necessary? CanplotObj
be undefined?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@camdecoster There's several tests which pass an empty object (
{}
) asplotObj
, which was leading to an error causing the test to fail.I'm not sure if
plotObj
is supposed to be a DOM object or if other types are allowed.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like in the actual code (tests aside),
Events.init()
is only called in one place, and the argument is the output ofgetGraphDiv()
, which cannot benull
orundefined
but it could theoretically be some other type besides a DOM element.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should modify the tests rather than adding this
if
statement.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just use the optional chaining operator? I think that would essentially do the same thing as the
if
block, but is more compact and you wouldn't have to update any tests.plotObj?.addEventListener("wheel", () => {});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, TIL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@camdecoster I've reverted to the
if
statement due to the conditional chaining operator not being supported in our build pipeline (see #7477) -- are you OK with me merging as it is currently?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this code will work fine.