Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
archmoj merged 8 commits intomasterfromsafari-scroll-zoom
Jul 18, 2025

Conversation

@emilykl
Copy link
Contributor

Closes#7452

archmoj reacted with thumbs up emoji
@gvwilsongvwilson added P1needed for current cycle fixfixes something broken labelsJul 18, 2025
Copy link
Contributor

@archmojarchmoj left a comment

Choose a reason for hiding this comment

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

Thanks for the update.
Please add a draft log.
💃

Comment on lines +68 to +70
if(typeofplotObj.addEventListener==='function'){
plotObj.addEventListener("wheel",()=>{});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is theif block necessary? CanplotObj be undefined?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@camdecoster There's severaltests which pass an empty object ({}) asplotObj, which was leading to anerror causing the test to fail.

I'm not sure ifplotObj is supposed to be a DOM object or if other types are allowed.

Copy link
ContributorAuthor

@emilyklemilyklJul 18, 2025
edited
Loading

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 inone place, and the argument is the output ofgetGraphDiv(), which cannot benull orundefined but it could theoretically be some other type besides a DOM element.

Copy link
ContributorAuthor

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 thisif statement.

Copy link
Contributor

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 theif block, but is more compact and you wouldn't have to update any tests.
plotObj?.addEventListener("wheel", () => {});

emilykl reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Nice, TIL.

Copy link
ContributorAuthor

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 theif 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?

Copy link
Contributor

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.

@emilyklemilykl marked this pull request as ready for reviewJuly 18, 2025 16:22
* https://github.com/d3/d3/issues/3035
* https://github.com/plotly/plotly.js/issues/7452
*/
plotObj.addEventListener?.("wheel",()=>{});
Copy link
Contributor

Choose a reason for hiding this comment

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

The operator should come afterplotObj in case that value is null/undefined. Where it is now, it could fail ifplotObj isn't defined.

Suggested change
plotObj.addEventListener?.("wheel",()=>{});
plotObj?.addEventListener("wheel",()=>{});

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@camdecoster Yes, but the specific case causing the test failures was thatplotObj was defined butplotObj.addEventListener was undefined.

I guess we could doplotObj?.addEventListener?.("wheel", () => {}); to cover both.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I misunderstood what you were saying before. In this case,plotObj equals{}. Then it's fine to leave it as you had it. No need to add unnecessary checks. It can always be addressed later if it becomes a problem.

emilykl reacted with thumbs up emoji
Co-authored-by: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com>
package.json Outdated
},
"overrides": {
"falafel": {
"acorn":"^8.1.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel comfortable introducing overriding dependencies like that in this PR, specially if we want to release a patch.
IMHO This should be discussed in a separate PR.
I suggest we use bring back the if statement.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

OK. I'll put back theif statement for now and open a separate PR for discussing upgradingacorn.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@archmoj@camdecoster I have opened#7478 regarding theacorn override

@archmoj
Copy link
Contributor

Thank you@emilykl
💃

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@camdecostercamdecostercamdecoster approved these changes

+1 more reviewer

@archmojarchmojarchmoj approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@emilyklemilykl

Labels

fixfixes something brokenP1needed for current cycle

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Scroll zoom doesn't work in safari

5 participants

@emilykl@archmoj@camdecoster@gvwilson

[8]ページ先頭

©2009-2025 Movatter.jp