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

[select] Consider making the popover-ness automatic #703

Closed
domenic opened this issue Mar 31, 2023 · 1 comment
Closed

[select] Consider making the popover-ness automatic #703

domenic opened this issue Mar 31, 2023 · 1 comment
Labels
select These are issues that relate to the select component

Comments

@domenic
Copy link
Contributor

domenic commented Mar 31, 2023

First, the explainer seems to be out of date and is using popup="" instead of popover="".

But that aside, this is very weird:

The element with behavior="listbox" is required to be a <div popup=popup>.

There aren't any other cases I can think of in HTML where to get the effect you want, you have to trigger some other related effect. E.g., you don't have to do <input type=text contenteditable> to make it clear that text inputs are editable. You just get that for free.

Combined with #702 this could simplify the explainer's

<selectmenu class="my-custom-select">
  <div slot="listbox">
    <div popup behavior="listbox">
      <option>Option 1</option>
      <option>Option 2</option>
      <option>Option 3</option>
      <option>Option 4</option>
      <option>Option 5</option>
    </div>
  </div>
</selectmenu>

into

<selectmenu class="my-custom-select">
  <listbox>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
    <option>Option 4</option>
    <option>Option 5</option>
  </listbox>
</selectmenu>

although I guess if you did #645 then even the <listbox> wrapper would not be necessary because you could just target the listbox in CSS.


This idea isn't free, as you need to think through some of the interactions on the API side. E.g. what happens if someone does add popover=""? What does listbox.popover return by default? Etc. But I think this things are worth thinking through, to give a better developer experience.

@josepharhar josepharhar added the select These are issues that relate to the select component label Apr 6, 2023
@josepharhar
Copy link
Collaborator

I agree, I am doing this in the explainer here: #798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
select These are issues that relate to the select component
Projects
None yet
Development

No branches or pull requests

2 participants