diff --git a/packages/block-library/src/tab/save.js b/packages/block-library/src/tab/save.js index e0d50b1cbac879..dca2d2856dbed3 100644 --- a/packages/block-library/src/tab/save.js +++ b/packages/block-library/src/tab/save.js @@ -18,6 +18,7 @@ export default function save( { attributes } ) {
diff --git a/packages/block-library/src/tabs/block.json b/packages/block-library/src/tabs/block.json index 89b715f064d9ba..49598ad5521195 100644 --- a/packages/block-library/src/tabs/block.json +++ b/packages/block-library/src/tabs/block.json @@ -41,5 +41,6 @@ } }, "editorStyle": "wp-block-tabs-editor", - "style": "wp-block-tabs" + "style": "wp-block-tabs", + "viewScriptModule": "file:./view.min.js" } diff --git a/packages/block-library/src/tabs/save.js b/packages/block-library/src/tabs/save.js index e858f9c43f4da0..dc7637d9b002cd 100644 --- a/packages/block-library/src/tabs/save.js +++ b/packages/block-library/src/tabs/save.js @@ -20,7 +20,11 @@ export default function save( { attributes } ) { } ); return ( -
+
    { innerTabs.map( ( tab, index ) => { const isActive = index === 0; @@ -34,7 +38,9 @@ export default function save( { attributes } ) { > { + const context = getContext(); + context.activeTab = index; + }, + }, +} );