Skip to content

react-i18n: Add support for self-closing elements in formatHTML#7034

Merged
aduth merged 6 commits intomainfrom
aduth-fix-react-i18n-interpolate-void-element
Sep 30, 2022
Merged

react-i18n: Add support for self-closing elements in formatHTML#7034
aduth merged 6 commits intomainfrom
aduth-fix-react-i18n-interpolate-void-element

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Sep 27, 2022

🛠 Summary of changes

Context: #7029 (comment)

Previously, formatHTML would only allow for balanced HTML tags (with an opening and closing tag), and would not support self-closing tags such as <br /> or <img />. This pull request adds that support.

For review: Note that this includes a TypeScript conversion and splits the original index.js to function-specific files. It will be easier to review each commit in isolation, where the actual fix is implemented in 7ad8244.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • yarn test passes
  • Confirm there are no regressions in the rendering of text content on the document capture step

aduth and others added 2 commits September 28, 2022 08:48
See: #7034 (comment)
Co-Authored-By: Matt Gardner <5004319+allthesignals@users.noreply.github.com>
@aduth aduth merged commit 9705e38 into main Sep 30, 2022
@aduth aduth deleted the aduth-fix-react-i18n-interpolate-void-element branch September 30, 2022 18:24
@aduth aduth mentioned this pull request Oct 3, 2022
jskinne3 pushed a commit that referenced this pull request Oct 12, 2022
* Split, convert react-i18n package to TypeScript

* react-i18n: Add support for self-closing elements in formatHTML

changelog: Internal, Localization, Support self-closing HTML tags in localization helper

* Add documentation for react-i18n

* Run Prettier on README

* Add (failing) regression coverage for dropped text

See: #7034 (comment)
Co-Authored-By: Matt Gardner <5004319+allthesignals@users.noreply.github.com>

* Fix dropped text following self-closing tag

Co-authored-by: Matt Gardner <5004319+allthesignals@users.noreply.github.com>
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