Skip to content

Commit

Permalink
Fixed html tags <a> or <input> not reacting to touch events
Browse files Browse the repository at this point in the history
  • Loading branch information
salmonb committed Sep 1, 2023
1 parent 94e8383 commit df62873
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@ protected static boolean passHtmlTouchEventOnToFx(TouchEvent e, String type, jav
javafx.scene.input.MouseEvent mouseEvent = new javafx.scene.input.MouseEvent(eventType, p.getSceneX(), p.getSceneY(), p.getScreenX(), p.getScreenY(), MouseButton.PRIMARY, fxTouchEvent.getTouchCount(), fxTouchEvent.isShiftDown(), fxTouchEvent.isControlDown(), fxTouchEvent.isAltDown(), fxTouchEvent.isMetaDown(),
!requestPdrExit /* primaryButtonDown must be false for a pdr exit, true otherwise */, false, false, false, false, false, null);
((Scene) fxTarget).impl_processMouseEvent(mouseEvent);
return true; // We return true (even if not consumed) to always prevent browsers built-in touch scrolling
// We return true (even if not consumed) to always prevent browsers built-in touch scrolling, unless if the
// target is a standard html tag that reacts to touch elements, such as <a> or <input> (ex: slider)
if (e.target instanceof HTMLAnchorElement || e.target instanceof HTMLInputElement)
return false;
return true;
}
return consumed; // should be normally: return consumed
}
Expand Down

0 comments on commit df62873

Please sign in to comment.