matrix-react-sdk icon indicating copy to clipboard operation
matrix-react-sdk copied to clipboard

Use span and style instead of font (W3C compliance)

Open Lamecarlate opened this issue 3 years ago • 7 comments

Currently, the rainbow command output a series of <font> elements. This HTML element has been depreciated in HTML4.01, and is obsolete in HTML5. This PR changes this to <span style="color:the-colour"> instead.

I don't know if it's an enhancement (it's very small) or a fix (the current code still works, it's just W3C-invalid). Could someone help me on that? Thanks.

Signed-off-by: Lara Dufour [email protected]


This PR currently has no changelog labels, so will not be included in changelogs.

A reviewer can add one of: T-Deprecation, T-Enhancement, T-Defect, T-Task to indicate what type of change this is, or add Type: [enhancement/defect/task] to the description and I'll add them for you.

Lamecarlate avatar Jun 08 '22 09:06 Lamecarlate

This needs changing at the spec level first. https://spec.matrix.org/v1.2/client-server-api/#mroommessage-msgtypes does not allow style on span tags.

t3chguy avatar Jun 08 '22 09:06 t3chguy

This also does not work because we apply the spec as a sanitizer for allowed html tags & attributes.

image image

t3chguy avatar Jun 08 '22 10:06 t3chguy

This needs changing at the spec level first. https://spec.matrix.org/v1.2/client-server-api/#mroommessage-msgtypes does not allow style on span tags.

Oh. I didn't know that.

After reading the specs, data-mx-color is permitted. Does this attribute give colour to the element it's on? I did only change the code and fire yarn test, because I don't know how to deploy a complete Matrix + Element environment in order to test in conditions.

Lamecarlate avatar Jun 08 '22 10:06 Lamecarlate

because I don't know how to deploy a complete Matrix + Element environment in order to test in conditions.

You can use the Netlify deployment made by this PR

image

Or follow https://github.com/vector-im/element-web/#setting-up-a-dev-environment

t3chguy avatar Jun 08 '22 10:06 t3chguy

After reading the specs, data-mx-color is permitted. Does this attribute give colour to the element it's on?

In theory, it is worth testing. But also the spec says that font+color is fine so there is no reason to change it before the spec deprecates that to follow the HTML spec.

t3chguy avatar Jun 08 '22 10:06 t3chguy

I suggest opening an issue in https://github.com/matrix-org/matrix-spec recommending deprecating the font tag in favour of span, this PR is neither a defect nor an enhancement whilst font is not deprecated in the Matrix spec.

t3chguy avatar Jun 08 '22 10:06 t3chguy

Yes, I'll do that, thank you @t3chguy !

Lamecarlate avatar Jun 08 '22 10:06 Lamecarlate

@Lamecarlate as mentioned in previous comments, this PR would need an MSC. You can read here about the process. I will close this PR until the MSC is there. Feel free to add another comment here if you want it reopened. Thank you also for your efforts so far.

weeman1337 avatar Nov 17 '23 07:11 weeman1337