@@ -56,24 +56,24 @@ function keyTabs(e) {
5656 * @param {Node } e the element that was clicked
5757 */
5858function changeTabs ( e ) {
59- const target = e . target ;
60- const selected = target . getAttribute ( "aria-selected" ) === "true" ;
61- const positionBefore = target . parentNode . getBoundingClientRect ( ) . top ;
59+ // Use this instead of the element that was clicked, in case it's a child
60+ const selected = this . getAttribute ( "aria-selected" ) === "true" ;
61+ const positionBefore = this . parentNode . getBoundingClientRect ( ) . top ;
6262
63- deselectTabset ( target ) ;
63+ deselectTabset ( this ) ;
6464
6565 if ( ! selected ) {
66- selectTab ( target ) ;
67- const name = target . getAttribute ( "name" ) ;
68- selectGroupedTabs ( name , target . id ) ;
66+ selectTab ( this ) ;
67+ const name = this . getAttribute ( "name" ) ;
68+ selectGroupedTabs ( name , this . id ) ;
6969
70- if ( target . classList . contains ( "group-tab" ) ) {
70+ if ( this . classList . contains ( "group-tab" ) ) {
7171 // Persist during session
7272 session . setItem ( 'sphinx-tabs-last-selected' , name ) ;
7373 }
7474 }
7575
76- const positionAfter = target . parentNode . getBoundingClientRect ( ) . top ;
76+ const positionAfter = this . parentNode . getBoundingClientRect ( ) . top ;
7777 const positionDelta = positionAfter - positionBefore ;
7878 // Scroll to offset content resizing
7979 window . scrollTo ( 0 , window . scrollY + positionDelta ) ;
0 commit comments