element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
Apache License 2.0
10.99k stars 1.95k forks source link

Investigate CSS files for obsolete style rules and remove them #25238

Closed luixxiul closed 10 months ago

luixxiul commented 1 year ago

Your use case

What would you like to do?

Investigate CSS files for obsolete style rules and remove them.

Why would you like to do it?

With recent PRs (https://github.com/matrix-org/matrix-react-sdk/pull/10733, https://github.com/matrix-org/matrix-react-sdk/pull/10687, https://github.com/matrix-org/matrix-react-sdk/pull/10659, https://github.com/matrix-org/matrix-react-sdk/pull/10550, https://github.com/matrix-org/matrix-react-sdk/pull/10548, https://github.com/matrix-org/matrix-react-sdk/pull/10496, and https://github.com/matrix-org/matrix-react-sdk/pull/10451), I have removed CSS style rules which have been obsolete since several years.

As we do not have a concrete policy or a tool to prevent style rules from becoming obsolete (creating a tracker or linter to detect obsolete rules is indeed unrealistic. see: https://github.com/vector-im/element-web/issues/25149), I am confident that nobody really knows how much style rules have become obsolete.

Since the rules removed by those PRs have been found just coincidentally, we should be able to detect a lot of obsolete rules if we check CSS files for them intentionally.

How would you like to achieve it?

There is not a tool for automation, therefore, manual labor; investigate each file, remove obsolete rules, create E2E tests if necessary.

Have you considered any alternatives?

I imagine that introducing Compress should reduce a chance of letting rules become obsolete, but it does not detect rules which have already become obsolete, unless it would replace the whole UI, making all of the rules obsolete all at once (which I believe would not happen).

Additional context

No response

For references, here is a list of all CSS files under res/css:

Johennes commented 10 months ago

Thanks for reporting this. Given that this will need to be an ongoing effort, I think we should first explore automated tooling for finding dead CSS. Therefore, I'm closing this in favor of https://github.com/vector-im/element-web/issues/23067.