Skip to content

Show the sound's file name, not "A Recording", in the image audio submenu (BL-16669) - #8235

Merged
StephenMcConnel merged 1 commit into
masterfrom
fix-image-sound-menu-label
Aug 26, 2026
Merged

Show the sound's file name, not "A Recording", in the image audio submenu (BL-16669)#8235
StephenMcConnel merged 1 commit into
masterfrom
fix-image-sound-menu-label

Conversation

@JohnThomson

@JohnThomson JohnThomson commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

When you choose a sound to play when an overlay image (or a draggable) is clicked, the context menu's audio submenu shows a row that plays that sound — and it was labelled "A Recording" instead of the name of the file you chose. The parent menu row above it shows the file name correctly, so the same sound was named two different ways one line apart, and with several sounds around you could not tell from the submenu which one was attached. That row had also lost the check mark showing which sound is currently in effect.

Cause

The submenu row passed the file name as its englishLabel but also carried l10nId: "ARecording". The localization lookup wins over englishLabel, so the name was never displayed. "A Recording" is the correct label for the text case (makeChooseAudioMenuItemForText), where a talking-book recording has no file name to show; the image path picked that id up when this menu was ported to the declarative canvas control registry. Before the port the row was built with l10nId: null, the file name as its label, and a check mark — the port dropped both.

Fix

  • playCurrentAudio in canvasControlRegistry.ts no longer sets an l10nId, so its englishLabel (the chosen sound's file name, minus .mp3) is what renders — the same idiom the parent row already uses.
  • Restored the check mark on that row, marking the sound currently in effect.
  • Added a vitest unit test pinning both, plus a guard that a sound file name containing a % reaches the label undecoded — the convention this card established for these names. The test was verified to fail when the l10nId is put back, so it genuinely catches the regression rather than passing vacuously. This required exporting makeChooseAudioMenuItemForImage.
  • Unrelated but in the same area: repaired openCanvasToolTab in the canvas Playwright helpers. It looked for the Canvas tool header as h3[data-toolid=...], but the React toolbox now renders tool headers as MUI accordion summaries with data-toolid on a span, so every canvas e2e test was failing in the fixture before reaching its assertions. The h3 selectors are kept alongside the new one.

No localizable strings were added, changed, or removed: ARecording is still used by the text path, so its XLF entry stays live.

Follow-up to BL-16669 — the sound file names this menu displays are the same unencoded names that card's fix established.

Devin review


This change is Reviewable

@JohnThomson

Copy link
Copy Markdown
Contributor Author

[Claude Opus 5 (1M context)] Consulted Devin on 2026-08-25 16:05 up to commit 01d43df0e674e692113f3e45062c1bf95edcf513.

Review came back clean: no Bugs, no Investigate flags, and no Informational items. Nothing to mirror as review threads.

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR restores the selected sound filename and check mark in the image-audio submenu while retaining the localized recording label for text audio.

  • Removes the overriding localization ID from the current-image-sound row.
  • Adds focused Vitest coverage for filename, visibility, check mark, no-sound, and percent-containing filename behavior.
  • Updates the canvas Playwright helper to locate the React/MUI toolbox header while retaining legacy selectors.

Important Files Changed

Filename Overview
src/BloomBrowserUI/bookEdit/toolbox/canvas/canvasControlRegistry.ts Correctly allows the current sound filename to render and restores its selected-state icon without changing the text-recording path.
src/BloomBrowserUI/bookEdit/toolbox/canvas/imageAudioMenuItem.test.ts Adds direct regression coverage for the image-audio menu metadata and relevant filename edge case.
src/BloomBrowserUI/bookEdit/canvas-e2e-tests/helpers/canvasFrames.ts Extends the toolbox-header locator for the current MUI markup while preserving compatibility with legacy markup.

Reviews (3): Last reviewed commit: "Show the sound's file name, not "A Recor..." | Re-trigger Greptile

@JohnThomson JohnThomson changed the title Show the sound's file name, not "A Recording", in the image audio submenu Show the sound's file name, not "A Recording", in the image audio submenu (BL-16669) Aug 25, 2026
@JohnThomson

Copy link
Copy Markdown
Contributor Author

[Claude Opus 5 (1M context)] Consulted Devin on 2026-08-25 16:34 up to commit ce8ddb382d9ebb96de91541c85068d872a899d70 (the unit-test commit).

Re-review clean — no Bugs and no Investigate flags, so nothing was mirrored as review threads.

One Informational item, not posted as a thread and not acted on: it notes that the menu label strips only a .mp3 suffix, so a sound with a different extension would show its extension. Devin flags it as pre-existing and consistent with the parent row, which is right, and the case is unreachable from the UI anyway — the sound chooser offers only MP3 files (showDialogToChooseSoundFileAsync passes extensions: ["mp3"]).

@JohnThomson
JohnThomson deleted the fix-image-sound-menu-label branch August 25, 2026 21:42
@JohnThomson
JohnThomson restored the fix-image-sound-menu-label branch August 25, 2026 21:43
@JohnThomson JohnThomson reopened this Aug 25, 2026

@JohnThomson JohnThomson left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnThomson reviewed 3 files and all commit messages.
Reviewable status: 0 of 3 files reviewed, all discussions resolved.

@JohnThomson JohnThomson left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnThomson made 1 comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion.


src/BloomBrowserUI/bookEdit/canvas-e2e-tests/helpers/canvasFrames.ts line 79 at r1 (raw file):

    const canvasToolHeader = toolboxFrame
        .locator(
            '.MuiAccordionSummary-root:has([data-toolid="canvas"]), h3[data-toolid="canvasTool"], h3[data-toolid="canvas"], h3[data-toolid*="canvas"], h3:has-text("Canvas")',

This is an unrelated change that fixes a bug Claude found in e2e testing.

…menu (BL-16669)

When a sound is chosen to play when an overlay image or draggable is
clicked, the submenu row that plays that sound showed the localized
string "A Recording" instead of the chosen file's name, even though the
parent menu row shows the name correctly. That row had also lost the
check mark showing which sound is currently in effect.

The row passed the file name as its englishLabel but also carried
l10nId "ARecording", and the localization lookup wins over englishLabel,
so the name was never displayed. "A Recording" is the right label for the
text case (makeChooseAudioMenuItemForText), where a talking-book
recording has no file name to show; the image path picked the id up
during the port to the declarative canvas control registry. Before that
port the row was built with l10nId null, the file name as its label, and
a check mark. Both are restored here.

Adds a unit test pinning the labels, plus a guard that a sound file name
containing a '%' reaches the label undecoded -- the convention BL-16669
established for these names. The test was verified to fail when the
l10nId is put back, so it catches the regression rather than passing
vacuously. This required exporting makeChooseAudioMenuItemForImage, since
there is no other way to assert these labels without a running Bloom and
the canvas e2e suite cannot currently complete a run (BL-16752).

Also, unrelated to the bug: repair openCanvasToolTab in the canvas
Playwright helpers. It looked for an h3[data-toolid], but the React
toolbox now renders tool headers as MUI accordion summaries with the
data-toolid on a span, so every canvas e2e test was failing in the
fixture before reaching its assertions. The h3 selectors are kept.

No localizable strings were added, changed, or removed: the text path
still uses ARecording, so its XLF entry stays live.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JohnThomson
JohnThomson force-pushed the fix-image-sound-menu-label branch from ce8ddb3 to 8fb0a31 Compare August 25, 2026 23:00
@JohnThomson
JohnThomson marked this pull request as ready for review August 25, 2026 23:01

@StephenMcConnel StephenMcConnel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StephenMcConnel reviewed 3 files and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on JohnThomson).

@StephenMcConnel
StephenMcConnel merged commit eb3651a into master Aug 26, 2026
3 checks passed
@StephenMcConnel
StephenMcConnel deleted the fix-image-sound-menu-label branch August 26, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants