From 07f6760bdf6fc0a569c506c705fd00520c86df19 Mon Sep 17 00:00:00 2001 From: Paolo Tesei Date: Fri, 29 Nov 2024 18:45:34 +0100 Subject: [PATCH] fix tabs in front --- src/blockparty-tabs/script.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/blockparty-tabs/script.js b/src/blockparty-tabs/script.js index e889919..38f8623 100644 --- a/src/blockparty-tabs/script.js +++ b/src/blockparty-tabs/script.js @@ -25,9 +25,11 @@ class TabsAutomatic { for ( let i = 0; i < this.tabs.length; i += 1 ) { const tab = this.tabs[ i ]; - const tabpanel = document.getElementById( - tab.getAttribute( 'aria-controls' ) - ); + const tabpanel = this.tablistNode + .closest( '.wp-block-blockparty-tabs' ) + .querySelectorAll( '.wp-block-blockparty-tabs-panels > *' )[ + i + ]; tab.tabIndex = -1; tab.setAttribute( 'aria-selected', 'false' );