PATCH: don't force selection of first element in multi-select input.
Hi all, Great job on dillo! Below is a patch that prevents the browser from selecting the first element of a multi-select input. Thanks, - Dmitri. --- a/src/form.cc Mon Nov 02 13:41:37 2009 -0300 +++ b/src/form.cc Tue Nov 03 12:57:02 2009 -0500 @@ -767,8 +767,8 @@ void Html_tag_close_select(DilloHtml *ht DilloHtmlInput *input = Html_get_current_input(html); DilloHtmlSelect *select = input->select; - // BUG(?): should not do this for MULTI selections - select->ensureSelection (); + if (DILLO_HTML_INPUT_SEL_LIST != input->type) + select->ensureSelection (); SelectionResource *res = (SelectionResource*)input->embed->getResource(); select->addOptionsTo (res);
Dmitri wrote:
Hi all,
Hi Dmitri
Great job on dillo!
:)
Below is a patch that prevents the browser from selecting the first element of a multi-select input.
It looks like that would change the behaviour for size > 1 even if multiple is not set. *digs into the spec a little* Technically, section 17.6.1 just says that "If no OPTION element has the selected attribute set, user agent behavior for choosing which option is initially selected is undefined", as opposed to coming out and saying that we don't have to preselect _any_ for the multiple case if we don't want to. Checking good old firefox, let's see... If size is 1 and multiple is not set, one has to be selected in the option menu, of course. If size > 1, it does not force a selection, regardless of whether multiple is set. For some reason, that seems more reasonable to me in the multiple case than in the non-multiple case. But if we want to simply copy firefox here and we know that it doesn't break websites, I'd be all right with that.
It looks like that would change the behaviour for size > 1 even if multiple is not set.
I see what you mean, there's a bug in my patch. I did not see that rows == 1 && multi == false in Html_tag_open_select(). I will try to come up with a new one... I need to save the 'multi' somewhere and then be able to check it in Html_tag_close_select(). C++ is not my forte. - Dmitri.
participants (2)
-
corvid@lavabit.com
-
dtikhonov@yahoo.com