File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,9 +245,20 @@ export const CommentsExtension = createExtension(
245245 mark . type . name === markType && mark . attrs . orphan !== true ,
246246 ) ;
247247
248- const threadId = commentMark ?. attrs . threadId as
249- | string
250- | undefined ;
248+ if ( ! commentMark ) {
249+ // Clicked outside any comment thread. Deselect if needed but
250+ // don't consume the event so other handlers (e.g. link
251+ // navigation) can process it.
252+ if ( store . state . selectedThreadId !== undefined ) {
253+ store . setState ( ( prev ) => ( {
254+ ...prev ,
255+ selectedThreadId : undefined ,
256+ } ) ) ;
257+ }
258+ return false ;
259+ }
260+
261+ const threadId = commentMark . attrs . threadId as string ;
251262
252263 // If the clicked thread is already selected, do nothing and let
253264 // other handlers process the event (e.g. navigating a link).
You can’t perform that action at this time.
0 commit comments