File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/pydata_sphinx_theme/assets/scripts Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -288,6 +288,9 @@ var setupSearchButtons = () => {
288
288
* @param {event } event the event that trigger the check
289
289
*/
290
290
function checkPageExistsAndRedirect ( event ) {
291
+ // ensure we don't follow the initial link
292
+ event . preventDefault ( ) ;
293
+
291
294
const currentFilePath = `${ DOCUMENTATION_OPTIONS . pagename } .html` ;
292
295
const tryUrl = event . currentTarget . getAttribute ( "href" ) ;
293
296
let otherDocsHomepage = tryUrl . replace ( currentFilePath , "" ) ;
@@ -299,10 +302,6 @@ function checkPageExistsAndRedirect(event) {
299
302
. catch ( ( error ) => {
300
303
location . href = otherDocsHomepage ;
301
304
} ) ;
302
-
303
- // ↓ this prevents the browser from following the href of the clicked node
304
- // ↓ (which is fine because this function takes care of redirecting)
305
- event . preventDefault ( ) ;
306
305
}
307
306
308
307
/**
You can’t perform that action at this time.
0 commit comments