Skip to content

Fix missing variable event in switcher handlers#39

Merged
mcsf merged 1 commit intomasterfrom
fix/36-unbound-event
Feb 9, 2017
Merged

Fix missing variable event in switcher handlers#39
mcsf merged 1 commit intomasterfrom
fix/36-unbound-event

Conversation

@mcsf
Copy link
Copy Markdown
Contributor

@mcsf mcsf commented Feb 9, 2017

Fixes error in #37 Fixed in #36, but I'll still merge this one for the refactor.

Also: refactor, because why not?
@mcsf mcsf force-pushed the fix/36-unbound-event branch from 7e9d177 to c5e0278 Compare February 9, 2017 20:16
@mcsf mcsf merged commit f7de13c into master Feb 9, 2017
@mcsf mcsf deleted the fix/36-unbound-event branch February 9, 2017 20:17
@mcsf mcsf added [Type] Bug An existing feature does not function as intended UI Prototype labels Feb 9, 2017
omarreiss pushed a commit that referenced this pull request Jun 26, 2018
…-hooks

Correctly enable dashes in regexes in validateNamespace
hypest pushed a commit that referenced this pull request Nov 2, 2018
…c-scss-import

Platform specific scss imports
hypest pushed a commit that referenced this pull request Nov 2, 2018
ntwb added a commit that referenced this pull request May 31, 2020
Add peerDependencies section to package.json and declare stylelint dependency version
pkevan pushed a commit to pkevan/gutenberg that referenced this pull request Oct 13, 2025
scruffian added a commit that referenced this pull request Feb 11, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 12, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 13, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 17, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 24, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 25, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 26, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes ')
  - Update @arraypress/waveform-player to ^1.2.0
scruffian added a commit that referenced this pull request Feb 27, 2026
* Playlist Block: Add WaveformPlayer visualization

Replace the browser's native audio controls with an interactive waveform
visualization using @arraypress/waveform-player library. This provides:

- Consistent waveform visualization across all browsers
- Visual progress indication during playback
- Interactive seeking by clicking on the waveform
- Keyboard accessibility (arrow keys for seeking)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* share more code

* remove player header

* update comment

* remove unneeded function exposure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* remove try catch

* inline the current track component

* move options into configs and add i18n

* make the heigt configurable

* remove extra defensive coding for the fallback

* fix autoplay

* fix the editor

* Remove player header

* fix the current track display in the editor

* add duration in editor

* remove border from the play button

* update comment

* remove the refs and just reinit whenever the tracklisting changes

* remove _x since we have to provide a translators comment anyway

* Replace useEffect and setTimeout with useRefEffect

* simplify rendering

* remove waveformInstanceRef

* remove custom events

* add a comment to explain the problems with destroy()

* change the setTimeout to listen for waveformplayer:ready

* add error logging

* remove double encoding

* update to locked version

* Fix playlist waveform player edge cases and cleanup

  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes &#39;)
  - Update @arraypress/waveform-player to ^1.2.0

* remove the gap between the button and the player

* extract aria label to function

* more more code to separate functions

* remove duplicate styles from editor.scss

* move play button accessibility changes to a separate function

* add tests for the extracted functions

* move the waveform component to utils for better separation of concerns

* Refactor to use the same function in the editor and frontend

* add more tests

* simplify view.js by moving more things to utils

* remove next track delay as we dont need it

* remove dead code

* remove more dead code

* update to the latest version of the library

* simplify autoplay

* fix resizing in the editor

* fix styling in the editor

* remove unneeded styles

* use @use

* add tests for the PHP render

* add jsdom to tests

* tidy up styles

* set text color via JS

Pass text colors to the waveform library via data attributes
instead of overriding inline styles with !important in CSS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix PHPCS

* fix tests

* fix PHPCS

* rename test

* strip tags from the ariaLabel

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor test to share the basePlayerData

* remove redundant test

* update test description

* try using the import

* import the CSS into the style.scss file

* remove the container when we destroy it

* Consolidate optional attribute tests in waveform-utils

Combine three separate tests for optional attributes (title, artist,
artwork) into a single test that verifies all optional attributes are
set when provided. This reduces redundancy while maintaining coverage.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Simplify waveform player accessibility with hardcoded label

Remove the ariaLabel parameter from setupPlayButtonAccessibility and
initWaveformPlayer, replacing it with a hardcoded "Play" label. This
simplifies the API while maintaining keyboard seeking functionality
(ArrowLeft/Right navigation).

The keyboard seeking feature is preserved as it provides valuable
accessibility for navigating through audio content.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* no need to set role button on a button

* add this fix for now

* remove seeking

* pass labels from the server

* use loadTrack instead of destroy

* remove change

* Fix unhandled promise rejection and stale URL cache on loadTrack failure

Add .catch(logPlayError) to the loadTrack() promise chain and move the
URL cache update inside .then() so it only persists on success. This
prevents unhandled rejections on network errors and allows the user to
retry loading the same track.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Sanitize track metadata with wp_strip_all_tags() to prevent XSS

The third-party waveform-player library uses innerHTML for the subtitle
field in its createDOM() method. Use wp_strip_all_tags() instead of raw
values to prevent HTML injection, without double-encoding in the JSON
context of wp_interactivity_state().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* explain why we have an AbortError

* Remove scale(1.05) hover effect from waveform player button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update packages/block-library/src/playlist/index.php

Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>

* Apply suggestions from code review

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>

Co-authored-by: scruffian <scruffian@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: jeryj <jeryj@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Mayank-Tripathi32 added a commit to Mayank-Tripathi32/gutenberg that referenced this pull request Feb 27, 2026
…s `false` to `get_search_query()` so it returns the unescaped\nquery string. `WP_HTML_Tag_Processor::set_attribute()` already\nhandles attribute escaping, so pre-escaping from `get_search_query()`\ncaused double-encoding (e.g. `ada&WordPress#39;s` instead of `ada's`).
gziolo pushed a commit that referenced this pull request Mar 3, 2026
* Playlist Block: Add WaveformPlayer visualization

Replace the browser's native audio controls with an interactive waveform
visualization using @arraypress/waveform-player library. This provides:

- Consistent waveform visualization across all browsers
- Visual progress indication during playback
- Interactive seeking by clicking on the waveform
- Keyboard accessibility (arrow keys for seeking)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* share more code

* remove player header

* update comment

* remove unneeded function exposure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* remove try catch

* inline the current track component

* move options into configs and add i18n

* make the heigt configurable

* remove extra defensive coding for the fallback

* fix autoplay

* fix the editor

* Remove player header

* fix the current track display in the editor

* add duration in editor

* remove border from the play button

* update comment

* remove the refs and just reinit whenever the tracklisting changes

* remove _x since we have to provide a translators comment anyway

* Replace useEffect and setTimeout with useRefEffect

* simplify rendering

* remove waveformInstanceRef

* remove custom events

* add a comment to explain the problems with destroy()

* change the setTimeout to listen for waveformplayer:ready

* add error logging

* remove double encoding

* update to locked version

* Fix playlist waveform player edge cases and cleanup

  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes &#39;)
  - Update @arraypress/waveform-player to ^1.2.0

* remove the gap between the button and the player

* extract aria label to function

* more more code to separate functions

* remove duplicate styles from editor.scss

* move play button accessibility changes to a separate function

* add tests for the extracted functions

* move the waveform component to utils for better separation of concerns

* Refactor to use the same function in the editor and frontend

* add more tests

* simplify view.js by moving more things to utils

* remove next track delay as we dont need it

* remove dead code

* remove more dead code

* update to the latest version of the library

* simplify autoplay

* fix resizing in the editor

* fix styling in the editor

* remove unneeded styles

* use @use

* add tests for the PHP render

* add jsdom to tests

* tidy up styles

* set text color via JS

Pass text colors to the waveform library via data attributes
instead of overriding inline styles with !important in CSS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix PHPCS

* fix tests

* fix PHPCS

* rename test

* strip tags from the ariaLabel

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor test to share the basePlayerData

* remove redundant test

* update test description

* try using the import

* import the CSS into the style.scss file

* remove the container when we destroy it

* Consolidate optional attribute tests in waveform-utils

Combine three separate tests for optional attributes (title, artist,
artwork) into a single test that verifies all optional attributes are
set when provided. This reduces redundancy while maintaining coverage.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Simplify waveform player accessibility with hardcoded label

Remove the ariaLabel parameter from setupPlayButtonAccessibility and
initWaveformPlayer, replacing it with a hardcoded "Play" label. This
simplifies the API while maintaining keyboard seeking functionality
(ArrowLeft/Right navigation).

The keyboard seeking feature is preserved as it provides valuable
accessibility for navigating through audio content.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* no need to set role button on a button

* add this fix for now

* remove seeking

* pass labels from the server

* use loadTrack instead of destroy

* remove change

* Fix unhandled promise rejection and stale URL cache on loadTrack failure

Add .catch(logPlayError) to the loadTrack() promise chain and move the
URL cache update inside .then() so it only persists on success. This
prevents unhandled rejections on network errors and allows the user to
retry loading the same track.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Sanitize track metadata with wp_strip_all_tags() to prevent XSS

The third-party waveform-player library uses innerHTML for the subtitle
field in its createDOM() method. Use wp_strip_all_tags() instead of raw
values to prevent HTML injection, without double-encoding in the JSON
context of wp_interactivity_state().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* explain why we have an AbortError

* Remove scale(1.05) hover effect from waveform player button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update packages/block-library/src/playlist/index.php

Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>

* Apply suggestions from code review

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>

Co-authored-by: scruffian <scruffian@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: jeryj <jeryj@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
scruffian added a commit that referenced this pull request Mar 3, 2026
  - Use ownerDocument.defaultView.getComputedStyle for iframe compatibility
  - Fix memory leak: clean up handleReady listener on destroy
  - Fix race condition: verify track is still current after delay
  - Add error handling for auto-advance play()
  - Move styleSvgIcons to ready event when icons exist
  - Remove unused bgColor from getWaveformColors
  - Remove inappropriate esc_html() for JSON context (fixes &#39;)
  - Update @arraypress/waveform-player to ^1.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant