Skip to content

Conversation

@tcannonfodder
Copy link
Contributor

Add errorMessageListItemWithHTML to parse an HTML string for rendering

Add support for html_content in error mapping

  • The html_content key in an error map can be used to render rich
    markup for an error message instead of the plaintext message
    • If present, message is ignored.
    • Under the hood, applyErrorMappingToForm calls
      errorMessageListItemWithHTML for an error entry if html_content
      evaluates to a truthy value

* For cases where we need to render rich error markup (such as server-
	rendered errors), this method provides us with a (mostly) safe way of
	doing so by utilizing `DOMParser`
	* See: https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString
* The `html_content` key in an error map can be used to render rich
	markup for an error message instead of the plaintext `message`
	* If present, `message` is ignored.
	* Under the hood, `applyErrorMappingToForm` calls
		`errorMessageListItemWithHTML` for an error entry if `html_content`
		evaluates to a truthy value
@tcannonfodder tcannonfodder merged commit 3d8f7db into main Apr 23, 2025
1 check passed
@tcannonfodder tcannonfodder deleted the thomas/pract-140-add-optional-html_content-property-to-error-mapping branch April 23, 2025 20:46
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