[Bug 12245] @size on <select> drop-downs is not enough to specify the drop-down maxlength on long options lists with scrollbars

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12245

--- Comment #23 from Jonas Sicking <jonas@sicking.cc> 2011-05-13 05:03:49 UTC ---
> We can solve it through CSS, but it seems to me that the attribute @size which
> already exists would already be the right means to solve the problem.

Actually, as I pointed out in comment 13, we can't use the @size attribute for
this since it's used to choose between a dropdown and listbox.

> > > > Why do you want web applications to behave differently
> > > > from desktop apps? People generally aim for the opposite.
> > > 
> > > I don't want HTML to work differently to desktop apps. Desktop 
> > > applications allow me to restrict the length of the drop-down.
> > 
> > Sure, but they don't generally limit the size to that of a contained
> > widget, right?
> 
> No. And again, that's not what I'm after. I want a means to be able to set
> the height from JavaScript.

We're definitely going in circles here :)

You keep saying that you want to limit the number of displayed items. I keep
asking why you want to do so.

So far the only answer you've given is that you want to display the dropdown
within a given widget (such as a video or an iframe), but when I point out that
your proposed solution doesn't cover that usecase you say that that is not the
use case you are after.

> I can already calculate how much space I have available
> through other means and if I want to stay within the height of a video element
> or an iframe or whatever, I have that height. I also have the height of each
> entry in the drop-down. So, if I can tell the browser how many items I want to
> display maximum, then I can limit the size to whatever I need.

How are you getting the height of a entry in the drop-down? I guess
getComputedStyle on a individual <option> could work, though I'm not sure that
that gives the right value in implementations that doesn't use CSS to display
the dropdown, such as the one in Safari. I'm also not sure that it'll work
while the items aren't displayed, such as when the dropdown is not expanded,
since there won't be any frames for it. We could require that to work of
course...

If the use-case is to ensure that the dropdown is a given size in pixels (or
mm), such that it can "stay within the height of a video element or an iframe
or whatever", it seems weird to me though require the page to first calculate
the size of each individual item, then divide the desired height by the item
height, and finally to set the size expressed in items. Not to mention the pain
if <option>s can be differently sized...

Seems much simpler to be able to set the size in pixels (or mm) in the first
place.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 13 May 2011 05:03:54 UTC