bkardell / common-panel

An effort to define a new element with clear semantics and separation
14 stars 3 forks source link

Should common-panel-set element have selectedIndex? #5

Open bkardell opened 9 years ago

bkardell commented 9 years ago

It seems like an obvious sort of add, select boxes (another kind of single-select mechanism) have this, as do most implementations of tabs, decks and accordions. If so it'd be reflected so you could do

myPanelSet.selectedIndex = 4;

And it would update the attribute and do the right thing. I didn't start with that because there are numerous cases where that sort of API is clunkier than dealing with element references you'd get another way, but I can definitely see it's utility.

LJWatson commented 9 years ago

The idea being that you could select a specific panel to be displayed by default? Makes sense to me.

bkardell commented 9 years ago

@LjWatson no, you can do that in markup with the expansion state today and using an index to set via markup is markedly harder... the idea being that you could read this attribute or read/write the runtime javascript property to say "select the third one". We basically have to track this internally anyway and that's functionally how it's managed, so exposing it seems kind of non-harmful and I can imagine some cases where it could be useful.