EDIT: short story I made a code sandbox:
open in Safari for mac and you will see this if you stretch a little bit the window:
If you click on the text, it justifies correctly.
I have a very intriguing bug on Safari for mac (12.0.3), the text doesn't properly justify (screenshot 1) at first render, it only correctly justifies after clicking on it (screenshot 2).
I am using React with Material-UI and overriding the style of all my body2 directly in my theme.js
file as follow:
body2: {
textAlign: "justify"
}
This implementation works correctly on Chrome. The string is coming from my backend which retrieves it from google firestore. The new lines are represented by \n
characters. I am looking to solve this issue and not find a work around (as replacing \n
character by <br />
html tags)
What I tried:
- searching for issues related to
text-align: justify
on Safari - trying to play with the
text-justify
property
I actually have no clue where to look to solve this and never had a bug of this sort (change of css after click without any onClick
logic implemented.). That's why I listed so many tags, because I have no real idea for the moment.
After clicking on it, it displays correctly:
Additional information:
<Typography paragraph>
{description}
</Typography>
I also override the root Typography like this (if I don't, new lines from firestore strings are not displayed):
MuiTypography: {
root: {
whiteSpace: "pre-line"
},
body2: {
fontSize: 15,
textAlign: "justify"
}
},