[whatwg] [WA1] <sl> - The Selection List element

James Graham jg307 at cam.ac.uk
Fri Jun 3 02:26:22 PDT 2005

Matthew - I assume you meant to send this to the list?

Matthew Raymond wrote:

> James Graham wrote:
>> Matthew Raymond wrote:
>>> R.J.Koppes wrote:
>>>> I don't really see the advantage above using ordinary lists or form 
>>>> controls
>>>> and css pseudoclasses like :target ,:focus and :active
>>>   Let's look at these pseudoclasses one at a time...
>>>   The :target pseudoclass only applies to an element that has its 
>>> |id| attribute as part of the URL. If it isn't in the URL, or the 
>>> URL changes so that the |id| is no longer in the URL, then the 
>>> styling is not applied.
>> So your example:
>> | <sl>
>> |   <li><a href="#s1">Section 1</a></li>
>> |   <li><a href="#s2">Section 2</a></li>
>> |   <li><a href="#s3">Section 3</a></li>
>> | </sl>
>> You click a link, the URL changes as required and the section in 
>> question matches the :target selector, no?
>    Which tab is originally selected then? Does the user have to put 
> "#s1" in the URL order for Section 1 to be the default selected tab? 
> And what happens if the author wants to have a hyperlink within 
> Section 1 that jumps to a subsection? What if it's not a tabstrip and 
> you want the user to be able to select multiple items in the list? 

> What happens when you have two or more sets of tabs? 

Er, you have a UI problem ;) But yes, in general, the :target selector 
wasn't designed to solve this problem.

> The :target selector is hopelessly inadequate.
> > Or are you suggesting messing
>> with the semantics of <a> when an ancestor is a <sl>? If so, that 
>> seems like a bad idea (does the spec do this already in places? can 
>> we avoid it?)
>    It's my understanding that when you click on a child event, the 
> event bubbles out to the parents. My suggestion is that 
> activation/click events on the children of <sl> elements and have them 
> trigger selection of the <sl> element regardless of what the child 
> element is, even if it's a text node.

Selection of the <sl> child that recieves the click event (and 
deselection of any other children of the <sl>), no?

>>> | <sl multiple="multiple">
>>> |   <li>Name 1</li>
>>> |   <li>Name 2</li>
>>> |   <li>Name 3</li>
>>> | </sl>
>>>   If multiple items are selected, and the user performs a drag
>>> operation on a list item, the drag would automatically be performed on
>>> all list items selected rather than just the list item being dragged. 
>> This seems like a very specific construct that doesn't solve the 
>> general problem - allowing the author to specify groups of items that 
>> can be manipulated in certain ways (e.g. mutually exclusive 
>> selection, dragging of a set of items).
>    I haven't fully explored how <sl> (although I clearly implied, if 
> not stated outright, that <sl> without the |multiple| attribute has 
> mutually exclusive selection), and I didn't intend to, since that part 
> of the WA1 spec is still in flux. My intent was to get people thinking 
> about <sl> in the context of drag-drop so that we can define exactly 
> how <sl> and drag-drop interact. One possibility is that <sl> can have 
> default drag-drop behavior that you can then change using Javascript 
> and the DOM. Right now, though, I think it's still to early to tell.

Right, I wasn't quite clear. I understood that your suggestion allowed 
single selections but I don't think the data model is very flexible. 
Your suggestion appears to rely on all the selectable items having the 
same parent (a <sl> element). What happens if you want to allow multiple 
items in a table to be selected (imagine a table representing a calendar 
which allows multiple days to be selected). It sounds like a problem 
that needs an attribute for grouping elements (class would be fine 
because all we're doing is grouping elements) and a way of specifying 
the type of relationship that the elements in a particular group have 
(e.g. they belong to the same set of selectable objects, they have the 
same drag / drop behavior, or whatever).

"But if science you say still sounds too deep,
Just do what Beaker does, just shrug and 'Meep!'"

-- Dr. Bunsen Honeydew & Beaker of Muppet Labs

More information about the whatwg mailing list