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

bug: scrollbar-color causing unnecessary repaints #3166

Open
CarlosBalladares opened this issue Aug 11, 2024 · 6 comments
Open

bug: scrollbar-color causing unnecessary repaints #3166

CarlosBalladares opened this issue Aug 11, 2024 · 6 comments
Labels

Comments

@CarlosBalladares
Copy link

CarlosBalladares commented Aug 11, 2024

What version of daisyUI are you using?

4.12.8

Which browsers are you seeing the problem on?

Edge Version 127

Reproduction URL

https://gph5tr-5173.csb.app/

Describe your issue

A css rule causes unnecessary repaints.

*:hover{
  scrollbar-color: ....
}

This rule is causing some unnecessary repaints when you hover any html element in the page.

To visualize in devtools enable paint flashing and hover over the two square boxes or any html element in the example link. Although nothing changes a paint flash appears when you hover the element. This behaviour stops when you remove the css selectors related to the scollbar color. This is also present in the daisyui homepage.

Potential solutions:

Remove this selector and add a utility class to customize the scrollbar only where needed.

Copy link

Thank you @CarlosBalladares for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

@CarlosBalladares
Copy link
Author

CarlosBalladares commented Aug 11, 2024

this is the css rule

/* scrollbar color */
* {
scrollbar-color: color-mix(in oklch, currentColor 35%, transparent) transparent;
&:hover {
scrollbar-color: color-mix(in oklch, currentColor 60%, transparent) transparent;
}
}

@binkybarnes
Copy link

with scrollbar-color in place, i cant customize the scrollbar with webkit

@danterohlin
Copy link

Is it a fix yet? Do I have to remove daisyui now to be able to style scrollbar?

@saadeghi
Copy link
Owner

saadeghi commented Sep 2, 2024

@danterohlin @binkybarnes
This issue is not about changing the color, it's about the performance of applying hover style for all elements which is unnecessary.

You can style the scrollbar using CSS scrollbar-color:
https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color

Example with Tailwind CSS utility classes:

class="[scrollbar-color:blue_yellow]"

In case you're using ::-webkit-scrollbar to style the scrollbar, it's a non standard CSS rule and will be removed from the browsers in the future. Ue the standard CSS scrollbar-color instead.

Also, this is one of the base styles. Which means can be disabled from config. Docs:
https://daisyui.com/docs/config/#base

@Muhammed-Rahif
Copy link

Muhammed-Rahif commented Oct 18, 2024

@danterohlin @binkybarnes both are correct. I can't customize scrollbar in any way when daisyui.com/docs/config#base is enabled (default). Disabling the base removes the colors, which I do not want to happen.

This issue is not about customizing scrollbar, even though the solution provided by the author fixes the scrollbar customization issue:

Remove this selector and add a utility class to customize the scrollbar only where needed.

@saadeghi saadeghi added the v5 label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants