openui / open-ui

Maintain an open standard for UI and promote its adherence and adoption.
https://open-ui.org
Other
3.53k stars 191 forks source link

Will the stylable <select> element be able to break outside the browser window? #1061

Open guillaumebrunerie opened 3 months ago

guillaumebrunerie commented 3 months ago

I remember that an earlier version of the explainer (when it was still called <selectlist>) explicitly pointed out the fact that unlike the <select> element, <selectlist> would not be allowed to break outside the browser window. But I can't see any mention of that anymore in the current version, is the plan now to allow it?

I understand that there might be security concerns with allowing a webapp to draw arbitrary content outside of its own window, but there are definitely situations where I wish I could customize the contents of a <select> better, while still allowing it to break out of the browser window, so I hope it will be allowed in some form.

lukewarlow commented 3 months ago

If you opt-in to the base styling for select then you won't be able to paint outside the frame.

I'd be curious to know what kind of styling you want and why you think you'd still want to paint outside the frame.

guillaumebrunerie commented 3 months ago

The app I am working on currently (internal tool at a company) allows you to replay user sessions (more or less). It works with two separate windows:

However, the secondary window also has a <select> to be able to choose which user session you want to replay. There can be quite a few to choose from, so when I first had a purely custom HTML/CSS select menu, it was pretty much unusable, as the secondary window is usually way smaller than the list of options, so I had to revert to a native <select> to be able to see the whole list from a small window.

As for the styling, I was trying for instance to change the color of some of the options (to mark in red the user sessions with errors), which isn’t possible. I guess I could use emojis instead as a workaround, but it feels like it should be possible to at least give a different color to an option without giving up features of the native <select>.

In a different app, I have a custom select menu used to choose an easing function between different options. Each easing function has a dynamically generated icon made with a small 2D canvas embedded next to each option:

Screenshot 2024-06-12 at 12 42 40

It is not super crucial for this one to be able to go outside the window, but again it would be nice to have the best of both worlds and not have to choose between customization and all features of the native <select>.

lukewarlow commented 3 months ago

"but it feels like it should be possible to at least give a different color to an option without giving up features of the native