Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Playlist: Import the waveform player's no-autoinit entry
1.27.0 ships `@arraypress/waveform-player/no-autoinit`, the same library
without the import-time scan for `[data-waveform-player]`. Importing it
directly replaces the `data-waveform-autoinit` set-and-restore wrapper,
along with its import-order constraint.

The restricted import now bans the default entry and every other subpath,
allowing only `no-autoinit`.
  • Loading branch information
manzoorwanijk committed Sep 30, 2026
commit e5bcec334a62f6fc074be37b7375e65ba34aeec2
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
- Image: Stop the lightbox from removing `inert` that a theme set on elements outside the overlay ([#83480](https://github.com/WordPress/gutenberg/pull/83480)).
- Image: Show the original image proportions in the lightbox and animate the thumbnail crop during zooming ([#79058](https://github.com/WordPress/gutenberg/pull/79058)).

### Internal

- Playlist: Update `@arraypress/waveform-player` to `^1.27.0` and import its `no-autoinit` entry, replacing the dependency patch ([#83132](https://github.com/WordPress/gutenberg/pull/83132)).

## 11.1.0 (2026-09-23)

### Enhancements
Expand All @@ -41,7 +45,6 @@

### Internal

- Playlist: Replace the `@arraypress/waveform-player` patch with the dependency's own `data-waveform-autoinit` opt-out, applied around a single wrapped import site ([#83132](https://github.com/WordPress/gutenberg/pull/83132)).
- Button: Replace deprecated `word-break: break-word` with `word-break: normal` and `overflow-wrap: anywhere` to clear the Stylelint suppression ([#82854](https://github.com/WordPress/gutenberg/pull/82854)).

## 11.0.0 (2026-09-10)
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"build-module/*/init.mjs"
],
"dependencies": {
"@arraypress/waveform-player": "^1.26.0",
"@arraypress/waveform-player": "^1.27.0",
"@wordpress/a11y": "file:../a11y",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/autop": "file:../autop",
Expand Down
32 changes: 0 additions & 32 deletions packages/block-library/src/utils/disable-waveform-autoinit.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

const AUTO_INIT_ATTRIBUTE = 'data-waveform-autoinit';

function createDeclarativePlayer() {
const element = document.createElement( 'div' );
element.setAttribute( 'data-waveform-player', '' );
Expand Down Expand Up @@ -51,9 +49,7 @@ describe( 'Waveform Player dependency', () => {
jsdomStubs.forEach( ( stub ) => stub.mockRestore() );
vi.useRealTimers();
vi.resetModules();
vi.doUnmock( '@arraypress/waveform-player' );
document.body.innerHTML = '';
document.documentElement.removeAttribute( AUTO_INIT_ATTRIBUTE );

if ( originalReadyState ) {
Object.defineProperty( document, 'readyState', originalReadyState );
Expand All @@ -63,10 +59,8 @@ describe( 'Waveform Player dependency', () => {
} );

/*
* Must run first: the dependency scans the document while its own module is
* evaluated, and `vi.resetModules()` does not re-evaluate dependencies, so
* the real scan is only observable on the first import in this file. The
* opt-out itself is covered order-independently below.
* Must run first: a scan would happen when the dependency is evaluated, and
* `vi.resetModules()` does not re-evaluate dependencies.
*/
it( 'leaves declarative markup it does not own uninitialized', async () => {
const element = createDeclarativePlayer();
Expand All @@ -75,9 +69,6 @@ describe( 'Waveform Player dependency', () => {

expect( element ).not.toHaveAttribute( 'data-waveform-initialized' );
expect( element ).toBeEmptyDOMElement();
expect( document.documentElement ).not.toHaveAttribute(
AUTO_INIT_ATTRIBUTE
);
} );

it( 'initializes declarative markup that is requested explicitly', async () => {
Expand All @@ -94,29 +85,4 @@ describe( 'Waveform Player dependency', () => {
element.querySelector( '.waveform-player-inner' )
).not.toBeNull();
} );

it( 'applies the opt-out before the dependency is evaluated', async () => {
let attributeWhenEvaluated;

vi.doMock( '@arraypress/waveform-player', () => {
attributeWhenEvaluated =
document.documentElement.getAttribute( AUTO_INIT_ATTRIBUTE );
return { default: class WaveformPlayerStub {} };
} );

await loadWaveformUtils();

expect( attributeWhenEvaluated ).toBe( 'false' );
} );

it( "restores the document's own opt-out value", async () => {
document.documentElement.setAttribute( AUTO_INIT_ATTRIBUTE, 'true' );

await loadWaveformUtils();

expect( document.documentElement ).toHaveAttribute(
AUTO_INIT_ATTRIBUTE,
'true'
);
} );
} );
13 changes: 0 additions & 13 deletions packages/block-library/src/utils/waveform-player-library.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/block-library/src/utils/waveform-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Used by both the WaveformPlayer component (editor) and view.js (frontend).
*/
import { colord } from 'colord';
import WaveformPlayerLib from './waveform-player-library';
import WaveformPlayerLib from '@arraypress/waveform-player/no-autoinit';

/**
* Configuration constants.
Expand Down
14 changes: 8 additions & 6 deletions tools/eslint/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,8 @@ export default dedupePlugins( [
},
},

// Override: block-library — the waveform player initializes every
// `[data-waveform-player]` element on the page when it is imported, so it
// has a single import site that opts the document out first.
// Override: block-library — the waveform player's default entry initializes
// every `[data-waveform-player]` element on the page when it is imported.
{
files: [ 'packages/block-library/**' ],
rules: {
Expand All @@ -1046,14 +1045,17 @@ export default dedupePlugins( [
{
name: '@arraypress/waveform-player',
message:
'Importing the waveform player initializes every `[data-waveform-player]` element on the page, including markup the Playlist block does not own. Import `utils/waveform-player-library` instead.',
'This entry initializes every `[data-waveform-player]` element on the page, including markup the Playlist block does not own. Import `@arraypress/waveform-player/no-autoinit` instead.',
},
],
patterns: [
{
group: [ '@arraypress/waveform-player/*' ],
group: [
'@arraypress/waveform-player/*',
'!@arraypress/waveform-player/no-autoinit',
],
message:
'Importing the waveform player initializes every `[data-waveform-player]` element on the page, including markup the Playlist block does not own. Import `utils/waveform-player-library` instead.',
'Only `@arraypress/waveform-player/no-autoinit` skips the scan that initializes every `[data-waveform-player]` element on the page.',
},
],
},
Expand Down