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

Tooltip jumps to upper left corner on map drag in Firefox #342

Open
pcaisse opened this issue Aug 21, 2020 · 1 comment
Open

Tooltip jumps to upper left corner on map drag in Firefox #342

pcaisse opened this issue Aug 21, 2020 · 1 comment

Comments

@pcaisse
Copy link
Contributor

pcaisse commented Aug 21, 2020

Description

Tooltip jumps to upper left corner on map drag

Steps To Reproduce

  1. Go to any map on staging
  2. Ensure default selection tool (hand) is chosen
  3. Mouse over any geounit so that tooltip is shown
  4. Drag map

Expected behavior

Tooltip continues to follow cursor

Actual behavior

Tooltip jumps to the upper left corner of the map

Screenshots

db_tooltip_drag_bug

Your environment

Saw this in Firefox but not in Chrome

  • OS: Ubunut 18.04
  • Browser Firefox 78.0.2
@pcaisse
Copy link
Contributor Author

pcaisse commented Apr 8, 2021

I looked in this and based on my testing it seems that offsetX and offsetY on e.originalEvent are always zero in Firefox: https://github.com/PublicMapping/districtbuilder/blob/develop/src/client/components/map/MapTooltip.tsx#L108

This may be a Mapbox bug or just a Firefox specific behavior.

There's another similar property (layerX/layerY) which seems to always have the same values as offsetX/offsetY in Chrome so that should also work. However, these properties are non-standard and their use seems to be discouraged: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/layerX

They're also not included in the TypeScript MouseEvent which Mapbox's MapMouseEvent extends, likely for that very same reason (non-standard and should be avoided).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants