diff --git a/packages/block-library/src/accordion-group/view.js b/packages/block-library/src/accordion-group/view.js index c21a1d0e4cdcd..cf1639710bdd3 100644 --- a/packages/block-library/src/accordion-group/view.js +++ b/packages/block-library/src/accordion-group/view.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { store, getContext, getElement } from '@wordpress/interactivity'; +import { store, getContext } from '@wordpress/interactivity'; const { state } = store( 'core/accordion', { state: { @@ -34,13 +34,5 @@ const { state } = store( 'core/accordion', { context.isOpen.push( id ); } }, - setTabIndex: () => { - const { ref } = getElement(); - ref.querySelectorAll( - 'button, a, input, textarea, select, summary, iframe' - ).forEach( ( el ) => { - el.tabIndex = state.isOpen ? 0 : -1; - } ); - }, }, } ); diff --git a/packages/block-library/src/accordion-item/index.php b/packages/block-library/src/accordion-item/index.php index dcbe9a801356a..d54f4e79819e4 100644 --- a/packages/block-library/src/accordion-item/index.php +++ b/packages/block-library/src/accordion-item/index.php @@ -46,7 +46,7 @@ function block_core_accordion_item_render( $attributes, $content ) { if ( $p->next_tag( array( 'class_name' => 'wp-block-accordion-content' ) ) ) { $p->set_attribute( 'id', $unique_id . '-content' ); $p->set_attribute( 'aria-labelledby', $unique_id ); - $p->set_attribute( 'data-wp-bind--aria-hidden', '!state.isOpen' ); + $p->set_attribute( 'data-wp-bind--inert', '!state.isOpen' ); $p->set_attribute( 'data-wp-watch', 'callbacks.setTabIndex' ); // Only modify content if all directives have been set.