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

[selectmenu] Method to apply styles only in open state #547

Closed
hidde opened this issue Jun 11, 2022 · 9 comments
Closed

[selectmenu] Method to apply styles only in open state #547

hidde opened this issue Jun 11, 2022 · 9 comments
Labels
needs edits This is ready for edits to be made select These are issues that relate to the select component

Comments

@hidde
Copy link
Contributor

hidde commented Jun 11, 2022

In a selectmenu-like pattern in our product, the button part has a background color while the select is open. I may be overlooking something obvious, but it looks to me like there isn't a way in the current <selectmenu> to apply styles to a button for an opened selectmenu.

select.mov

Video alt: text editor with selector for content semantics like heading level 1, heading level 2; while the selector is open, the button has a blue background, otherwise it is white

I wonder if there could be a way to allow for this, maybe through a pseudo class?

(Maybe related to #311)

@hidde hidde changed the title [selectmenu] Method to apply styled only in open state [selectmenu] Method to apply styles only in open state Jun 11, 2022
@captainbrosset
Copy link
Contributor

Correct, there is currently no way to style the selectmenu based on its open state (somewhat related too, there is no way to style it based on the position of the popup, which could be useful). This is a known limitation that I'm sure must be tracked somewhere, although I can't find an issue on this repo. @dandclark may know.

@hidde
Copy link
Contributor Author

hidde commented Jun 13, 2022

Ah yes, style based on position of popup would be great too, a common use case (and in video above) would be when the popup visually has an arrow that points to its trigger.

@dandclark
Copy link
Collaborator

I think it would make sense to have an :open pseudo class for this. I couldn't find an existing issue for this in the repro -- only the discussions relating to popup (#311). So unless someone else finds something let's track it here.

Styling based on the position of the popup would be a bit more complicated and the exact shape of it will depend on what comes out of the anchor positioning proposal. I would expect that for many use cases where developer cares about listbox positioning, they would be replacing the default listbox and swapping in their own, e.g. to add the arrow pointing back to the button. In this case they could query the popup position as it's exposed by anchor pos, without <selectmenu> also needing to expose this info. Although if it turns out to be useful to have it exposed on <selectmenu> that's something we could always add later.

@dandclark dandclark added the select These are issues that relate to the select component label Jun 29, 2022
@gregwhitworth gregwhitworth added the agenda+ Use this label if you'd like the topic to be added to the meeting agenda label Sep 26, 2022
@mfreed7
Copy link
Collaborator

mfreed7 commented Sep 29, 2022

For reference, CSSWG resolved to add :open which applies to things that can open and close. That would definitely seem to include <selectmenu>, as it explicitly already applies to <select>. I'm in favor of supporting :open here.

@hidde
Copy link
Contributor Author

hidde commented Oct 12, 2022

I forgot to set up the css-meeting-bot for this issue in the last minutes, so just to circle back:

Last week we got to this resolution:

<selectmenu> supports :open as specified in the CSSWG.

(as captured in the first part of the minutes)

@mfreed7
Copy link
Collaborator

mfreed7 commented Oct 13, 2022

I forgot to set up the css-meeting-bot for this issue in the last minutes, so just to circle back:

Last week we got to this resolution:

<selectmenu> supports :open as specified in the CSSWG.

(as captured in the first part of the minutes)

… and now also :closed.

@css-meeting-bot
Copy link

The Open UI Community Group just discussed [selectmenu] Method to apply styles only in open state.

The full IRC log of that discussion <gregwhitworth> Topic: [selectmenu] Method to apply styles only in open state
<gregwhitworth> github: https://github.com//issues/547
<JonathanNeal> dandclark: should css have a pseudo class to see whether the selectmenu is open or not. there will be one that can apply generally to things, and we will use that.

@dandclark
Copy link
Collaborator

From a prior meeting:

RESOLUTION: <selectmenu> supports :open as specified in the CSSWG.

@gregwhitworth gregwhitworth added needs edits This is ready for edits to be made and removed agenda+ Use this label if you'd like the topic to be added to the meeting agenda labels Oct 13, 2022
@dandclark dandclark reopened this Oct 13, 2022
josepharhar added a commit to josepharhar/open-ui that referenced this issue Mar 24, 2023
@josepharhar
Copy link
Collaborator

I am implementing :open and :closed in chromium here: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
I am adding :open and :closed to the selectmenu explainer here: #692

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 24, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 25, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
gregwhitworth pushed a commit that referenced this issue Mar 25, 2023
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 27, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 27, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}
aarongable pushed a commit to chromium/chromium that referenced this issue Mar 27, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 27, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this issue Mar 28, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}
cookiecrook pushed a commit to cookiecrook/wpt that referenced this issue Mar 29, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}
cookiecrook pushed a commit to cookiecrook/wpt that referenced this issue Apr 8, 2023
This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 13, 2023
…losed, a=testonly

Automatic update from web-platform-tests
selectmenu: Add support for :open and :closed

This was discussed here: openui/open-ui#547

Bug: 1121840
Change-Id: I44de1f38ce4c754b1046c2eea3837955ab026447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370850
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122593}

--

wpt-commits: 2f5784f5fe10d878efccabb2463ad9458b86e562
wpt-pr: 39200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs edits This is ready for edits to be made select These are issues that relate to the select component
Projects
None yet
Development

No branches or pull requests

7 participants