-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Paste handler classifies font-weight 500 as bold, though it should be normal #1692
Comments
According to those mozilla docs, what you're quoting is just the fallback behavior for fonts that do not support more than "normal" and "bold" (and from what I understand this is specific to Firefox). Other browsers / fonts that support more weights correctly render 500 as something heavier/thicker than normal text ("medium"), so it seems sensible to put it in the bold category. It would be strange to treat 500 values as not-bold just because some browsers/fonts do not support that granularity. |
Hmm, there are definitely quite a few sites (including the one I run) that use 500 as their normal body font, and additionally have a bold tag that uses 700 or higher. Copying from these sites results in everything being bolded. I don't know of any sites that use 500 as their bold font-weight, which would strike me as a pretty weird decision. And given the fallback behavior, it seems that firefox also thinks that if you try to translate a font with font-weight 500 to something that doesn't have that level of granularity, which is the problem we are facing here, then 500 should be interpreted as normal font-weight, not bold. |
Another datapoint might be that Firefox uses font-weight 500 as a fallback for normal text, if the font doesn't have a font-weight of 400. This also suggests that font-weight 500 is more naturally interpreted as normal text. |
For another data point, in our fork we made this change because we found 500 to be common and the transition to bold on paste pretty jarring. |
Hi @Discordius, thanks for raising this issue. It sounds reasonable what are your thoughts @flarnie ? |
Same as in our app as well - I need to handle this using |
I put up a PR with this change: |
Do you want to request a feature or report a bug?
I want to report a bug
What is the current behavior?
When you copy text with
font-weight: 500
, the draftJS paste handler applies a bold tag to the pasted text.This is the result of the following lines in this file:
What is the expected behavior?
But the mozilla documentation says the following:
Which puts font-weight 500 in the normal category, not the bold category.
The text was updated successfully, but these errors were encountered: