question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Touch event selection broken with css property zoom

See original GitHub issue

Do you want to request a feature or report a bug?

Bug

What’s the current behavior?

Touch drag and drop is broken with a zoom property applied to the body tag. Instead of coordinates being calculated properly, the offset is dramatic.

broken

What’s the expected behavior?

working

Can be reproduced with:

@media (max-width: 980px)
body {
    zoom: 200%;
    height: auto;
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
tobiasandersencommented, Apr 12, 2018

I don’t know what the general approach is to zoomed pages, but this sounds like a reasonable solution to me. I say go ahead and open a PR, and we’ll see what people have to say about it!

1reaction
pbarbierocommented, Mar 29, 2018

I have a solution, do you think its okay to make a pull request for this? Browser support should be fine, however it assumes that the zoom property is only set on the body tag. This might be an okay assumption.

in Selection.js, function getEventCoordinates:

    pageX: target.pageX / window.getComputedStyle(document.body).zoom,
    pageY: target.pageY / window.getComputedStyle(document.body).zoom
Read more comments on GitHub >

github_iconTop Results From Across the Web

Touch event selection broken with css property zoom #785
Touch drag and drop is broken with a zoom property applied to the body tag. Instead of coordinates being calculated properly, the offset...
Read more >
touch-action - CSS-Tricks
The touch-action property in CSS gives you control over the effect of touchscreen interactions with an element, similar to the more ...
Read more >
zoom - CSS: Cascading Style Sheets - MDN Web Docs
The non-standard zoom CSS property can be used to control the magnification level of an element. transform: scale() should be used instead ...
Read more >
Disable double-tap "zoom" option in browser on touch devices
CSS to disable double-tap zoom globally (on any element): ... You should set the css property touch-action to none as described in this...
Read more >
Simple Click Events | Maps JavaScript API - Google Developers
This example demonstrates the use of event listeners. It. listens for the click event on a marker to zoom the map when the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found