SAP / ui5-webcomponents-react

A wrapper implementation for React of the UI5 Web Components that are compliant with the SAP Fiori User Experience
https://sap.github.io/ui5-webcomponents-react/
Apache License 2.0
449 stars 101 forks source link

[Toolbar]: [Style is not applied if the style was passed through className] #6638

Closed jamesPodo closed 1 week ago

jamesPodo commented 1 week ago

Describe the bug

Style is not applied if the style was passed in className.

Isolated Example

https://stackblitz.com/edit/github-7dyw9x-zvlp9s?file=src%2FApp.tsx,src%2Findex.css

Reproduction steps

define style in css file, and pass className when creating Toolbar Component.

Expected Behaviour

style is applied correctly

Screenshots or Videos

Screenshot 2024-11-18 at 4 01 05 PM

UI5 Web Components for React Version

1.29.13

UI5 Web Components Version

1.24.13

Browser

Chrome

Operating System

Mac OS

Additional Context

No response

Relevant log output

No response

Organization

SAP SE

Declaration

Lukas742 commented 1 week ago

Hi @jamesPodo

the className including the styles are applied, but they're overridden by the component styles because of the injection order.

image

You can set the staticCssInjected prop of the ThemeProvider to true and import the static style sheet yourself:

https://stackblitz.com/edit/github-7dyw9x-zqacwu?file=src%2FApp.tsx,src%2Fmain.tsx

You can find out more about this here.

In V2 we wrapped all styles in a CSS layer, but we don't plan downporting this feature.