Fix fallthrough on user badge click on alerts page

This commit is contained in:
Jonathan Staab 2022-12-26 13:10:05 -08:00
parent 7a3338eeaa
commit 94dc7b9195
3 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,6 @@
<script>
import {Link} from 'svelte-routing'
import {killEvent} from 'src/util/html'
export let person
</script>
@ -7,7 +8,7 @@
<Link
to={`/people/${person.pubkey}/notes`}
class="flex gap-2 items-center relative z-10"
on:click={e => e.stopPropagation()}>
on:click={killEvent}>
<div
class="overflow-hidden w-4 h-4 rounded-full bg-cover bg-center shrink-0 border border-solid border-white"
style="background-image: url({person.picture})" />

View File

@ -3,6 +3,7 @@
import {ellipsize, quantify} from 'hurdak/src/core'
import Badge from "src/partials/Badge.svelte"
import {formatTimestamp} from 'src/util/misc'
import {killEvent} from 'src/util/html'
import {modal} from 'src/state/app'
export let note
@ -10,13 +11,13 @@
let isOpen = false
const openPopover = e => {
e.stopPropagation()
killEvent(e)
isOpen = true
}
const closePopover = e => {
e.stopPropagation()
killEvent(e)
isOpen = false
}
@ -33,6 +34,7 @@
{#if isOpen}
<div transition:fly={{y: 20}} class="fixed inset-0 z-10" on:click={closePopover} />
<div
on:click={killEvent}
transition:fly={{y: 20}}
class="absolute top-0 mt-8 py-2 px-4 rounded border border-solid border-medium
bg-dark grid grid-cols-3 gap-y-2 gap-x-4 z-20">

View File

@ -68,3 +68,9 @@ export const escapeHtml = html => {
return div.innerHTML
}
export const killEvent = e => {
e.preventDefault()
e.stopPropagation()
e.stopImmediatePropagation()
}