Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

svelte: Reduce imported global CSS#62457

Merged
fkling merged 1 commit into
mainfrom
fkling/62428-global-styles
May 8, 2024
Merged

svelte: Reduce imported global CSS#62457
fkling merged 1 commit into
mainfrom
fkling/62428-global-styles

Conversation

@fkling

@fkling fkling commented May 6, 2024

Copy link
Copy Markdown
Contributor

Part of #62428

Until now we've simply imported the global base.scss file, which in turn imports a bunch of other files and defines global CSS classes. Many (most?) of them are actually not used.

This commit reduces to the number of imported files to the ones that contain styles that are used. My methodology was to inspect every file that base.scss imports and find out whether it defines custom properties (variables) or global classes. In some cases I extracted variables into their own files.

I can't guarantee that the included files only declare styles that are used, but it's a first step.

Test plan

Compared all pages "side-by-side", switching between S2 and local tabs to catch any "drift", including the revision selector, search results popovers and search input suggestions.

@fkling fkling requested a review from vovakulikov May 6, 2024 14:21
@fkling fkling self-assigned this May 6, 2024
@cla-bot cla-bot Bot added the cla-signed label May 6, 2024
Until now we've simply imported the global `base.scss` file, which in
turn imports a bunch of other files and defines global CSS classes. Many
(most?) of them are actually not used.

This commit reduces to the number of imported files to the ones that
contain styles that are used. My methodology was to inspect every
file that `base.scss` imports and find out whether it defines custom
properties (variables) or global classes. In some cases I extracted
variables into their own files.
@fkling fkling force-pushed the fkling/62428-global-styles branch from 9cfc089 to 8172741 Compare May 6, 2024 14:21

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made a couple of changes here and related files that removed the use of classes for "outer component" styling.


form,
div,
:global([data-scroller]) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was affecting all scroll instances, which is wrong.

@fkling fkling added the team/code-search Issues owned by the code search team label May 6, 2024
@@ -0,0 +1,43 @@
:root {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have these variables on the global level? Should it be incorporated with a special Dropdown component instead of variables?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should it be incorporated with a special Dropdown component instead of variables?

That's what I would prefer. I haven't audited the code where these variables are used. In this PR I'm really just trying to remove the styles we are not using. Refactoring everything to properly scope it should be a separate PR (IMO).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agree, maybe we should leave a comment here that these variables are used at the moment but they shouldn't be used in any new components freely

@@ -0,0 +1,9 @@
:root {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same question as about dropdown variables: why do we need to have them on the global level instead of having them on the popover level?

We still can have some global variable that can effect popover variables like different box-shadows levels for instance.

@vovakulikov

Copy link
Copy Markdown
Contributor

Havent' tested this manually yet, so just left a few questions, will review it properly by the end of the day

@fkling fkling mentioned this pull request May 8, 2024

@vovakulikov vovakulikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked this manually, haven't noticed any UI regressions, thanks

@fkling fkling merged commit c1410f0 into main May 8, 2024
@fkling fkling deleted the fkling/62428-global-styles branch May 8, 2024 13:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/code-search Issues owned by the code search team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants