Skip to content

Fix FileWidget i18n msgid breakage introduced in #7982 - #8334

Merged
Wagner3UB merged 14 commits into
mainfrom
fix/file-widget-a11y-msgids
Jul 14, 2026
Merged

Fix FileWidget i18n msgid breakage introduced in #7982#8334
Wagner3UB merged 14 commits into
mainfrom
fix/file-widget-a11y-msgids

Conversation

@Wagner3UB

@Wagner3UB Wagner3UB commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

PR #7982 (FileWidget - a11y) inadvertently changed the id fields of several defineMessages entries in FileWidget.jsx and RegistryImageWidget.jsx. Since the id is the key used at runtime to look up translations in .po files, renaming them effectively broke all existing translations for those strings — any site that had already translated the old keys would silently fall back to the English default.

This PR does two things:

  1. Restores the original msgid id keys, so existing .po translations keep matching (backward compatibility).
  2. Updates the defaultMessage values to improve accessibility: the new strings describe both interaction methods ("Press Enter or click") instead of keyboard only, and a new dragAndDropReplaceA11y message distinguishes the "replace existing file" state from the initial "upload" state announced to assistive technology.
Message key Restored id (backward-compat) Updated defaultMessage (a11y)
editFile Drop file here to replace the existing file File upload area. Press Enter or click to replace the existing file.
fileDrag Drop file here to upload a new file File upload area. Press Enter or click to open the file browser.
dragAndDropActionA11y Press Enter to browse files from your computer. File upload area. Press Enter or click to open the file browser.
dragAndDropReplaceA11y (new) File upload area. Press Enter or click to replace the existing file.

The same defaultMessage updates are applied to RegistryImageWidget.jsx so both widgets share identical id and defaultMessage, avoiding an i18n extraction conflict on the shared keys.

@Wagner3UB

Copy link
Copy Markdown
Contributor Author

@stevepiercy I need your attention here. The same problem I had with the PR https://github.com/plone/volto/pull/8320 happened here, but the PR has been merged. So, I'm trying to do a rollback for those IDs.

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a tweak on the news fragment. Otherwise LGTM.

Was there a release made since the inadvertant msgid change? If so, then there also needs to be a mention in the upgrade guide.

Comment thread packages/volto/news/8334.bugfix Outdated
@Wagner3UB

Copy link
Copy Markdown
Contributor Author

Was there a release made since the inadvertant msgid change? If so, then there also needs to be a mention in the upgrade guide.

@stevepiercy Yes, https://github.com/plone/volto/releases/tag/19.1.3. What do I need to mention?

Co-authored-by: Steve Piercy <web@stevepiercy.com>
@Wagner3UB
Wagner3UB requested a review from stevepiercy June 15, 2026 12:01
@stevepiercy

Copy link
Copy Markdown
Member

@Wagner3UB good question, and I'm not exactly sure. I'd say that a note for 19.1.3, as well as another for the next released version, would be appropriate.

I'm not sure of the surface area, that is, the group of developers who might be affected by the change. My guess is developers who relied on the those msgids in their add-ons previous to Volto 19.1.3 and are using Volto 19.1.3. Maybe some of the folks who understand the implications better than I can verify? @erral @davisagli @sneridagh @pnicolli

@wesleybl

Copy link
Copy Markdown
Member

@Wagner3UB @stevepiercy If the text changes, shouldn't the id also change? Since ids are strings, I find it strange to have one text in the message and another in the id. It looks like an error. If I were using ids in my own project, I'd prefer the translations to "break." That would allow me to see the new message.

@stevepiercy

Copy link
Copy Markdown
Member

@wesleybl think of it as a Python dict. A msgid is a key, msgstr is the value. msgid is the key used to look up the translated text msgstr in the language domain. If your code refers to a msgid that changes, it won't find a translation.

@wesleybl wesleybl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review

Thanks for this fix! The core intent (restoring original msgid keys) is correct and important. A few issues to address:

1. DefaultMessage values are not unchanged (PR description is incorrect)

The PR description states "The defaultMessage values remain as introduced in #7982", but the diff shows FileWidget's defaultMessages are all being significantly changed to new accessibility-focused strings:

Message key Old defaultMessage (#7982) New defaultMessage (this PR)
editFile Drop a file here or click to replace the existing file File upload area. Press Enter or click to replace the existing file
fileDrag Drop a file here or click to upload File upload area. Press Enter or click to open the file browser
dragAndDropActionA11y File upload area. Press Enter to open the file browser File upload area. Press Enter or click to open the file browser

The new strings are better for accessibility. Please update the PR description to accurately reflect this.

2. Inconsistent editFile defaultMessage between FileWidget and RegistryImageWidget

Both widgets now share the same msgid "Drop file here to replace the existing file", but have different defaultMessages:

  • FileWidget.jsx: 'File upload area. Press Enter or click to replace the existing file' (new a11y text)
  • RegistryImageWidget.jsx: 'Drop file here to replace the existing file' (unchanged old text)

Is this intentional? If RegistryImageWidget should also show the new a11y-friendly text, its defaultMessage should be updated too.

3. visually-hiddenvisually-hidden-volto change is good but should be mentioned

This is a correct fix (aligns with Volto's convention used in Toast.jsx and UrlWidget.jsx), but it's unrelated to the i18n msgid restoration. Please document it in the PR description.

Minor: duplicate type="file" on the input

Pre-existing issue, but line 218 explicitly sets type: 'file' which is already handled by getInputProps() on line 217-219. Not introduced by this PR though.


After addressing #1 (description update), this looks good to approve.

@Wagner3UB
Wagner3UB requested a review from wesleybl July 13, 2026 09:41
@Wagner3UB

Copy link
Copy Markdown
Contributor Author

@wesleybl Done

@stevepiercy can you run your check here, please?

#. Default: "File upload area. Press Enter or click to replace the existing file"
#: components/manage/Widgets/FileWidget
msgid "File upload area. Press Enter to open the file browser"
msgid "File upload area. Press Enter or click to replace the existing file"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is changed from #7982. It was added in #7982. Was it included in a release? If so, then don't change the msgid. It's OK to change the Default.

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.

@stevepiercy This msgid wasn't added in #7982, it existed before and had translations as well. #7982 renamed Press Enter to browse files from your computer. into it, which broke those. This PR just restores the original msgid and only changes the Default, as you suggested.

My bad for the mess with the IDs. It caused a huge chain reaction.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread packages/volto/locales/volto.pot
Comment thread packages/volto/src/components/manage/Widgets/FileWidget.jsx Outdated
Comment thread packages/volto/src/components/manage/Widgets/RegistryImageWidget.jsx Outdated
@Wagner3UB
Wagner3UB requested a review from stevepiercy July 13, 2026 10:47
#. Default: "File upload area. Press Enter or click to replace the existing file"
#: components/manage/Widgets/FileWidget
msgid "File upload area. Press Enter to open the file browser"
msgid "File upload area. Press Enter or click to replace the existing file"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread packages/volto/locales/volto.pot

@wesleybl wesleybl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still find it strange for the id to be something other than 'default', but okay.

Comment thread docs/source/upgrade-guide/index.md
@read-the-docs-community

read-the-docs-community Bot commented Jul 13, 2026

Copy link
Copy Markdown

Documentation build overview

📚 volto | 🛠️ Build #33580059 | 📁 Comparing 2e59e4a against latest (a888abc)

  🔍 Preview build  

1 file changed
± upgrade-guide/index.html

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the upgrade guide entry. That's nice.

Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md
Comment thread packages/volto/src/components/manage/Widgets/FileWidget.jsx Outdated
Wagner3UB and others added 4 commits July 14, 2026 11:42
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Comment thread docs/source/upgrade-guide/index.md Outdated
Comment thread docs/source/upgrade-guide/index.md Outdated

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@Wagner3UB
Wagner3UB merged commit ff6c2f7 into main Jul 14, 2026
78 checks passed
@Wagner3UB
Wagner3UB deleted the fix/file-widget-a11y-msgids branch July 14, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants