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 = () => {
288288 * @param {event } event the event that trigger the check
289289 */
290290function checkPageExistsAndRedirect ( event ) {
291+ // ensure we don't follow the initial link
292+ event . preventDefault ( ) ;
293+
291294 const currentFilePath = `${ DOCUMENTATION_OPTIONS . pagename } .html` ;
292295 const tryUrl = event . currentTarget . getAttribute ( "href" ) ;
293296 let otherDocsHomepage = tryUrl . replace ( currentFilePath , "" ) ;
@@ -299,10 +302,6 @@ function checkPageExistsAndRedirect(event) {
299302 . catch ( ( error ) => {
300303 location . href = otherDocsHomepage ;
301304 } ) ;
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 ( ) ;
306305}
307306
308307/**
You can’t perform that action at this time.
0 commit comments