Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix design issues with recent react-intl upgrade #25272

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

ClearlyClaire
Copy link
Contributor

The react-intl upgrade changed the behavior of Formatted* components to not wrap translated messages in span tags anymore. While this is a pretty good change, it changes the DOM structure and breaks some of Mastodon's styling.

Finding all the places where this change breaks the styling may be a better long-term solution, but it's also a much more involved one, so this commit changes react-intl's configuration to always wrap formatted messages in a span tag.

See also: https://formatjs.io/docs/react-intl/upgrade-guide-3x#breaking-api-changes

The `react-intl` upgrade changed the behavior of `Formatted*` components to not
wrap translated messages in `span` tags anymore. While this is a pretty good
change, it changes the DOM structure and breaks some of Mastodon's styling.

Finding all the places where this change breaks the styling may be a better
long-term solution, but it's also a much more involved one, so this commit
changes `react-intl`'s configuration to always wrap formatted messages in
a `span` tag.
Copy link
Sponsor Member

@renchap renchap left a comment

Choose a reason for hiding this comment

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

Good catch, I missed this (potentially) breaking change when updating.

I agree that removing those <span> should be done, but I am not sure how to ensure nothing is broken, except manual testing everywhere…

@renchap renchap merged commit c2c3961 into mastodon:main Jun 5, 2023
supernovae pushed a commit to Universeodon-com/mastodon that referenced this pull request Jun 7, 2023
skerit pushed a commit to 11ways/mastodon that referenced this pull request Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ui Front-end, design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants