File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " next13-progressbar" ,
3- "version" : " 1.2.0 " ,
3+ "version" : " 1.2.1 " ,
44 "description" : " A ProgressBar for next.js >=13 with app directory " ,
55 "main" : " dist/index.js" ,
66 "types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -112,8 +112,9 @@ export const Next13ProgressBar = React.memo(
112112 const handleAnchorClick = ( event : MouseEvent ) => {
113113 const anchorElement = event . currentTarget as HTMLAnchorElement ;
114114
115- // Skip anchors with target="_blank"
116- if ( anchorElement . target === '_blank' ) return ;
115+ // Skip anchors with target="_blank" | "_top" | "_parent" | "_self"
116+ if ( anchorElement . target === '_blank' || anchorElement . target === '_top' || anchorElement . target === '_parent' )
117+ return ;
117118
118119 // Skip anchors with download attribute
119120 if ( anchorElement . hasAttribute ( 'download' ) ) return ;
@@ -138,8 +139,10 @@ export const Next13ProgressBar = React.memo(
138139
139140 const handleMutation : MutationCallback = ( ) => {
140141 const anchorElements = document . querySelectorAll ( 'a' ) ;
141- // Skip anchors with target="_blank" and anchors without href
142- const validAnchorELes = Array . from ( anchorElements ) . filter ( ( anchor ) => anchor . href ) ;
142+ const validAnchorELes = Array . from ( anchorElements ) . filter ( ( anchor ) => {
143+ if ( anchor . href . startsWith ( 'tel:+' ) || anchor . href . startsWith ( 'mailto:' ) ) return false ;
144+ return anchor . href && anchor . target !== '_blank' ;
145+ } ) ;
143146 validAnchorELes . forEach ( ( anchor ) => anchor . addEventListener ( 'click' , handleAnchorClick ) ) ;
144147 } ;
145148
You can’t perform that action at this time.
0 commit comments