Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add additional context variable to <FluentProvider> to allow for v9 / v8 interop #30304

Closed
1 task done
anenger opened this issue Jan 12, 2024 · 3 comments
Closed
1 task done

Comments

@anenger
Copy link
Contributor

anenger commented Jan 12, 2024

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

We have a project that is currently migrating from Fluent v8 to Fluent v9, and some downstream hosts do not support Fluent v9 as of yet. Therefore, we need an easy way to check if there is a Fluent v9 <FluentProvider> so that themes, styles, etc will render properly. Attempting to use useThemeClassName() !== "" does not work.

Exposing the theme context, like { theme } = useFluent() would work for this scenario.

I believe react-components/react-shared-contexts/src/ThemeContext/ThemeContext.ts has the context that we need to support this.

Have you discussed this feature with our team

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Priority

Normal

@micahgodbolt
Copy link
Member

i had success testing for v8 vs v9 themes using these context values:

https://codesandbox.io/p/sandbox/testing-for-v8-and-v9-themes-oclepm?file=%2Fsrc%2FApp.tsx%3A21%2C1-21%2C91

@anenger
Copy link
Contributor Author

anenger commented Jan 16, 2024

@micahgodbolt I couldn't get this to work in our repo - I think unfortunately the babel plugin requirement is a blocker for us. Is it possible to detect the v9 theme without that?

@anenger
Copy link
Contributor Author

anenger commented Jan 17, 2024

Codesandbox solution will work for our needs - the issue is on our side.

@anenger anenger closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants