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

fix: remove selector from theming #3879

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

tjuanitas
Copy link
Contributor

@tjuanitas tjuanitas commented Jan 29, 2025

There's currently a bug where theming isn't applying to floating components like dropdown menus because the component is inserted at the body of the DOM, outside of the UI Element.

Removing the selector functionality to insert the CSS variables at the root fixes this but it means UI Elements will have to share themes. The alternative approach is to individually portal all usages of the floating components but that sounds awful.

Theming applied to dropdown menu:
Screenshot 2025-01-29 at 1 58 17 PM

@tjuanitas tjuanitas requested review from a team as code owners January 29, 2025 21:53
@@ -11,15 +11,19 @@ const useCustomTheming = ({ selector, theme = {} }: ThemingProps) => {
.join(';');

useEffect(() => {
if (!styles) {
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't return anything here for useEffect. We would want to just end execution with return; right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! I wanted to do that but there's an eslint rule about consistent returns: https://eslint.org/docs/latest/rules/consistent-return#treatundefinedasunspecified

basically return; (implicit undefined) doesn't work but return undefined; (explicit) does work 🤷

https://stackoverflow.com/questions/67658900/arrow-function-expected-no-return-value-with-clean-up-function-in-useeffect

@mergify mergify bot merged commit 42b485f into box:master Jan 30, 2025
6 checks passed
@tjuanitas tjuanitas deleted the fix-remove-theme-selector branch January 30, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants