File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,27 @@ export function updateArticleLinks(doc: Document): number {
3636 const newHref = buildArticleUrl ( ARTICLE_LINK_MAP [ matchedId ] ) ;
3737
3838 anchorEl . setAttribute ( 'href' , newHref ) ;
39+
40+ // Prevent Zendesk's internal click handler from intercepting navigation.
41+ // We use capture phase so our handler fires before Zendesk's handlers on
42+ // the element. Guard against duplicate listeners on repeated calls.
43+ if ( ! anchorEl . dataset . helpPageRewritten ) {
44+ anchorEl . dataset . helpPageRewritten = 'true' ;
45+ anchorEl . addEventListener (
46+ 'click' ,
47+ ( event ) => {
48+ event . preventDefault ( ) ;
49+ event . stopImmediatePropagation ( ) ;
50+ window . open (
51+ anchorEl . getAttribute ( 'href' ) ?? newHref ,
52+ '_blank' ,
53+ 'noopener,noreferrer' ,
54+ ) ;
55+ } ,
56+ true ,
57+ ) ;
58+ }
59+
3960 updatedCount ++ ;
4061 }
4162 } ) ;
You can’t perform that action at this time.
0 commit comments