Skip to content

Global CSS is very harmful in certain environments / should really be fixed #11955

Description

@xdev1

Describe your motivation

Is it really necessary that Vaadin uses global CSS unexceptional?

Here are some examples:

color: var(--vaadin-text-color);
background: var(--aura-app-background);
background-size: 100vw 100vh;
background-attachment: fixed;

font: -apple-system-body;

:where(body),
:where(:host) {
font-family: var(--aura-font-family);
font-optical-sizing: auto;
font-style: normal;
font-weight: var(--aura-font-weight-regular);
/* Set to auto to disable grayscale/anti-aliased font smoothing (and use default sub-pixel anti-aliasing) */
-webkit-font-smoothing: var(--aura-font-smoothing, antialiased);
-moz-osx-font-smoothing: var(--aura-font-smoothing, grayscale);
/* We assume apps are built with responsive layouting in mind */
-webkit-text-size-adjust: none;
text-size-adjust: none;
}

You cannot really use Vaadin custom elements in Wikis, CMSs or similar environments if Vaadin always modifies global styles.

Describe the solution you'd like

Hopefully, I am missing something completely here 😉
If not, wouldn't it be a way better solution to separate global styles from component styles and to provide two ways to import Vaadin styles: One way to import all styles (like now) and one way to only import the component styles (including the Vaadin custom properties of course)?

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions