diff --git a/src/hooks/useATProtoLinks.hook.ts b/src/hooks/useATProtoLinks.hook.ts index 50278ec..6fcad04 100644 --- a/src/hooks/useATProtoLinks.hook.ts +++ b/src/hooks/useATProtoLinks.hook.ts @@ -17,8 +17,8 @@ export const useATProtoLinks = ( const { currentAtUri, mainNoteId } = options const linkNote = (event: Event) => { - const target = event.target as HTMLElement - const href = target.getAttribute("href") + const anchor = (event.target as HTMLElement).closest("a") + const href = anchor?.getAttribute("href") if (!href) { return diff --git a/src/hooks/useLinks.hook.ts b/src/hooks/useLinks.hook.ts index f099965..c837fb9 100644 --- a/src/hooks/useLinks.hook.ts +++ b/src/hooks/useLinks.hook.ts @@ -11,8 +11,8 @@ export const useLinks = ( const store = useUserRepoStore() const linkNote: EventListener = (event) => { - const target = event.target as HTMLElement - const href = target.getAttribute("href") + const anchor = (event.target as HTMLElement).closest("a") + const href = anchor?.getAttribute("href") if (!href) { return