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

Add utilities for scrollbar-width #5732

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,19 @@ export let corePlugins = {
})
},

scrollbarWidth: ({ addUtilities }) => {
addUtilities({
'.scrollbar-auto': { 'scrollbar-width': 'auto' },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be scrollbar-width-auto to avoid ambiguity with potential future utilities for scrollbar-gutter: auto or scrollbar-color: auto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#5750 - in my PR for scrollbar-gutter, I've gone with scrollbar-gutter-auto, as I imagine scrollbar-width will be the one to "claim" the ambiguous class if any property does.

'.scrollbar-thin': { 'scrollbar-width': 'thin' },
'.scrollbar-none': {
'scrollbar-width': 'none',
'&::-webkit-scrollbar': {
display: 'none',
},
},
})
},

textOverflow: ({ addUtilities }) => {
addUtilities({
'.truncate': { overflow: 'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap' },
Expand Down
9 changes: 9 additions & 0 deletions tests/raw-content.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,15 @@
.scroll-smooth {
scroll-behavior: smooth;
}
.scrollbar-thin {
scrollbar-width: thin;
}
.scrollbar-none {
scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar {
display: none;
}
.truncate {
overflow: hidden;
text-overflow: ellipsis;
Expand Down
2 changes: 2 additions & 0 deletions tests/raw-content.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
<div class="overflow-hidden"></div>
<div class="overscroll-contain"></div>
<div class="scroll-smooth"></div>
<div class="scrollbar-thin"></div>
<div class="scrollbar-none"></div>
<div class="p-4 py-2 px-3 pt-1 pr-2 pb-3 pl-4"></div>
<div class="place-content-start"></div>
<div class="placeholder-green-300"></div>
Expand Down