-
Notifications
You must be signed in to change notification settings - Fork 193
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
[select] Use the new ::behavior selector and clarify that ::part doesn't work #714
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,18 +52,18 @@ Selectmenu provides a variety of tools to help with styling, including pseudo-se | |
|
||
### Styling parts of the control | ||
|
||
One way to style the control to match your requirements is to use the CSS `::part()` pseudo-element to select the different parts within the control's anatomy that you wish to style. | ||
One way to style the control to match your requirements is to use the CSS `::behavior()` pseudo-element, newly introduced for the selectmenu element, to select the different parts within the control's anatomy that you wish to style. | ||
|
||
```html | ||
<style> | ||
.my-select-menu::part(button) { | ||
.my-select-menu::behavior(button) { | ||
color: white; | ||
background-color: #f00; | ||
padding: 5px; | ||
border-radius: 5px; | ||
} | ||
|
||
.my-select-menu::part(listbox) { | ||
.my-select-menu::behavior(listbox) { | ||
padding: 10px; | ||
margin-top: 5px; | ||
border: 1px solid red; | ||
|
@@ -84,7 +84,9 @@ The above example results in the following style: | |
alt="The rendering of a selectmenu control with the above HTML and CSS code" | ||
/> | ||
|
||
`::part()` can be used to style the `button`, `selected-value`, and `listbox` parts of the control. | ||
`::behavior()` can be used to style the `button`, `selected-value`, and `listbox` parts of the control. | ||
|
||
Note that the `::part()` pseudo-element selector only matches elements in the user-agent shadow tree, and hence, fails to match any author-provided part (as in [slotting your own content](#slotting-your-own-content)). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please wrap this with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also see my above comment on whether |
||
|
||
### `:open` and `:closed` pseudo-selectors | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should link out to the definition of behavior. Do we have one in CSSWG yet? If not we should probably expound on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know of a CSSWG issue proposing
::behavior
yet.If we remove the "newly introduced for the selectmenu element" part is that good enough to merge this now?
I'm hesitant to open a CSSWG issue proposing this just yet since domenic's general feedback could change how this works. I haven't even opened an HTML issue for selectmenu yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not in CSSWG yet.
I feel the same. Should we create a draft spec of
::behavior
somewhere at open-ui?