mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
VizTooltip: Check useragent to perform consistently on all mobile devices (#99655)
* Add useragent check to be comprehensive * move check outside function and add hopefully clarifying comment
This commit is contained in:
parent
0bf31c14a7
commit
52a6c27d99
@ -108,6 +108,8 @@ const maybeZoomAction = (e?: MouseEvent | null) => e != null && !e.ctrlKey && !e
|
||||
|
||||
const getDataLinksFallback: GetDataLinksCallback = () => [];
|
||||
|
||||
const userAgentIsMobile = /Android|iPhone|iPad/i.test(navigator.userAgent);
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
@ -666,8 +668,9 @@ export const TooltipPlugin2 = ({
|
||||
|
||||
// if not viaSync, re-dispatch real event
|
||||
if (event != null) {
|
||||
// we expect to re-dispatch mousemove, but on mobile we'll get mouseup or click
|
||||
const isMobile = event.type !== 'mousemove';
|
||||
// we expect to re-dispatch mousemove, but may have a different event type, so create a mousemove event and fire that instead
|
||||
// this doesn't work for every mobile device, so fall back to checking the useragent as well
|
||||
const isMobile = event.type !== 'mousemove' || userAgentIsMobile;
|
||||
|
||||
if (isMobile) {
|
||||
event = new MouseEvent('mousemove', {
|
||||
|
Loading…
Reference in New Issue
Block a user