Skip to content

Commit 95eb17d

Browse files
committed
+reactor/components/tabs/tabs.tis keyboard handling fix
1 parent 8e8a54a commit 95eb17d

File tree

1 file changed

+9
-3
lines changed
  • samples/+reactor/components/tabs

1 file changed

+9
-3
lines changed

samples/+reactor/components/tabs/tabs.tis

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class Tabs : Reactor.Component {
1111
this.atts = atts || {};
1212
this.data = { currentTab: kids[0][0].name || kids[0][0].label };
1313
}
14+
15+
function attached() {
16+
this.state.focusable = true;
17+
}
1418

1519
function render() {
1620

@@ -36,17 +40,19 @@ class Tabs : Reactor.Component {
3640
return <tabs><stripe>{labels}</stripe><div>{tabContent}</div></tabs>;
3741
}
3842

39-
event click $(stripe>label:not(.selected)) (evt,label) { return this.activateTab(label); }
43+
event click $(stripe>label:not(:current)) (evt,label) { return this.activateTab(label); }
4044

4145
event keydown (evt)
4246
{
4347

44-
var currentLabel = this.$(>stripe>label.selected);
48+
var currentLabel = this.$(>stripe>label:current);
4549

4650
switch( evt.keyCode )
4751
{
4852
case Event.VK_TAB:
49-
if( evt.ctrlKey ) return this.activateTab( evt.shiftKey? currentLabel.prior : currentLabel.next ); return true;
53+
if( evt.ctrlKey )
54+
return this.activateTab( evt.shiftKey? (currentLabel.prior || currentLabel.parent.last)
55+
: (currentLabel.next || currentLabel.parent.first)); return true;
5056
/*case Event.VK_LEFT: return this.activateTab( currentLabel.prior );
5157
case Event.VK_RIGHT: return this.activateTab( currentLabel.next );
5258
case Event.VK_HOME: return this.activateTab( currentLabel.parent.first );

0 commit comments

Comments
 (0)