[csswg-drafts] [css-forms-1] Can we simplify `select::picker(select)`? (#11394)

bramus has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-forms-1] Can we simplify `select::picker(select)`? ==
_(Disclaimer: I haven’t been involved in any of the discussions that lead to this selector, so I am most likely missing a lot of backstory and info … this is me personally looking at it without any extra knowledge about it.)_

Every time I see customizable select demos, the `select::picker(select)` stands out to me … in a weird way. It feels very weird because of the extra `select` at the end there. To me, `select::picker(select)` reads as _“Give me the `select` that is part of the `::picker` which belongs to the `<select>`”._ Huh?

The spec reads that the argument to `picker()` is the [unique picker name](https://drafts.csswg.org/css-forms-1/#unique-picker-name) that you want to target, and for `<select>` that is `select`. But that feels redundant to me, because the `select` at the start of `select::picker(select)` already implies that you are trying to access something related to the `<select>` element.

Looking at the explainer https://open-ui.org/components/customizableselect/#styling _(which I don’t know if it’s up-to-date or not)_ it says the pseudo targets the popover that contains the options that you can choose from. But AFAICT there is only popover per control. I also looked at #10462, #10758, and #10440 but could not find back an exact explanation to _why_ the extra `select` at the end is required.

This leads to me these questions:

- Why is the argument there? Is it because you would be able to a different picker name in the future – E.g. when one rolls their own custom picker on a certain element?
  - If not, then why have it?
- Allowing custom picker names or not, can’t we omit it by default and have the browser then target the default picker of that element?
  - E.g. `select::picker()` gives you what `select::picker(select)` currently gives you.
  - It knows what to select because it the context from the part before `::picker` … so for `<select>` it could choose the `select` unique picker name and for something like a date-picker it (in the future) would use the one for that control.

I’m sure I’m missing a lot of info/backstory here, so feel free to enlighten me on why this extra `picker` is absolutely necessary.

Perhaps, if this can’t be simplified, the spec could add a note that explains the reasoning behind it?

/cc @josepharhar @annevk @dbaron @fantasai who participated in the previous discussions on this.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11394 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 19 December 2024 10:34:24 UTC