mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 01:03:00 +08: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:
parent
2b6b7ed26e
commit
367a1b2329
|
@ -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(
|
||||
() => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user