mirror of
https://github.com/flarum/core.git
synced 2025-07-25 18:51:40 +02:00
Check if event is cancelable before preventDefault (#54)
This recovers the initial wanted behavior of opening the post mention preview dropdown instead of directly going to the post on touchscreens.
This commit is contained in:
@@ -103,7 +103,14 @@ export default function addPostMentionPreviews() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$this.on('touchstart', e => e.preventDefault());
|
// On a touch (mobile) device we cannot hover the link to reveal the preview.
|
||||||
|
// Instead we cancel the navigation so that a click reveals the preview.
|
||||||
|
// Users can then click on the preview to go to the post if desired.
|
||||||
|
$this.on('touchend', e => {
|
||||||
|
if (e.cancelable) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$this.add($preview).hover(
|
$this.add($preview).hover(
|
||||||
() => {
|
() => {
|
||||||
|
Reference in New Issue
Block a user