BotFramework-WebChat
BotFramework-WebChat copied to clipboard
Styles: add shadow DOM support
Fixes #5194
Changelog Entry
- (Experimental) Added support for using WebChat inside a shadow DOM, in PR #5196, by @OEvgeny
- Added
styleOptions.stylesRootproperty allowing users to specify the root node where WebChat styles should be placed, in PR #5196, by @OEvgeny - Added the
ThemeProvider.stylesproperty, allowing theme packages to place styles into the same root node as WebChat, in PR #5196, by @OEvgeny - Added
noncefor Fluent andreact-scroll-to-bottominjected styles, in PR #5196, by @OEvgeny - Updated
react-scroll-to-bottomto version4.2.1-main.53844f5, in PR #5196, by @OEvgeny - Updated
react-filmto version3.1.1-main.f623bf6, in PR #5196, by @OEvgeny
- Added
Description
The change allows to mount webchat inside of shadow roots by providing the container for emotion and Fluent styles.
TODO:
- [x]
react-scroll-to-bottomstyles: need to update emotion usage on the library side and update the library. - [x]
react-filmstyles: need to update emotion usage on the library side and update the library.
Design
The design encapsulates related code into dedicated modules and centralizes style injection.
With the new approach, the Fluent theme passes styles down to WebChat, which then determines the appropriate location to inject these styles.
Instead of calculating the root node before mounting the rest of the component tree, we let user specify the desired location for the styles.
Specific Changes
- Reworked
useStyleToEmotionObject - Added
useInjectStyles - Refactored
useStyleToEmotionObjectusage - Added the
stylesprop toThemeProvider - Renamed
ContextTypetoThemeContextType - Fluent: reworked
injectStylestocreateStyles - Added
styleOptions.stylesRoot - Added tests
-
- [x] I have added tests and executed them locally
- [x] I have updated
CHANGELOG.md - [x] ~I have updated documentation~
Review Checklist
This section is for contributors to review your work.
- [ ] Accessibility reviewed (tab order, content readability, alt text, color contrast)
- [ ] Browser and platform compatibilities reviewed
- [ ] CSS styles reviewed (minimal rules, no
z-index) - [ ] Documents reviewed (docs, samples, live demo)
- [ ] Internationalization reviewed (strings, unit formatting)
- [ ]
package.jsonandpackage-lock.jsonreviewed - [ ] Security reviewed (no data URIs, check for nonce leak)
- [ ] Tests reviewed (coverage, legitimacy)