Azure / communication-ui-library

UI Library for Azure Communication Services helps developers build communication applications with ease. From turn-key composites to UI components that can be composited together.
https://aka.ms/acsstorybook
MIT License
171 stars 72 forks source link

Unable to override global staticStyles in FluentThemeProvider #1969

Closed levimiller-qhrtech closed 2 years ago

levimiller-qhrtech commented 2 years ago

Describe the bug; what happened? The default teams theme from fluent ui adds a couple global styles that are extremely disruptive:

  '*': {
    boxSizing: 'border-box',
  },
  '*:before': {
    boxSizing: 'border-box',
  },
  '*:after': {
    boxSizing: 'border-box',
  },

These end up in a style tag at the bottom of the head tag which makes it very difficult to unset.

What are the steps to reproduce the issue? Use FluentThemeProvider in any way (including in a composite), inspect the dom for the style tag with data-fela-type="STATIC", find the wildcard styles right under normalize css.

What behavior did you expect? Some way to override these styles, or for them to be removed. Normalize css doesn't really bother me because it's not that intrusive, but the wildcard styles are very disruptive.

Maybe a field in the Theme object that's passed in to FluentThemeProvider/the composites?

If applicable, provide screenshots: Screen Shot 2022-06-06 at 5 54 03 PM

In what environment did you see the issue? N/A

Is there any additional information? I can work around it by wrapping everything in

import {  Provider } from '@fluentui/react-northstar';

<Provider theme={{
  staticStyles: [
    {
      '*': {
        boxSizing: 'unset',
      },
      '*:before': {
        boxSizing: 'unset',
      },
      '*:after': {
        boxSizing: 'unset',
      }
    }
  ]
}}>
</Provider>

Here's some links to where everything is happening:

PorterNan commented 2 years ago

Thanks for reporting the issue and also thanks for providing the workaround, this sounds like a fluent northstar issue that their provider is polluting global css environment, a new issue was just opened on their side. Since you have a nice workaround, so no hotfixes needed right now, let's keep our eyes on the issue on northstar side

anjulgarg commented 2 years ago

Closing this issue as we can't provide a fix for this and there is a workaround.