Skip to content

Commit f889a7f

Browse files
committed
Merge pull request scratchfoundation#194 from nathan/list-tabbing
Fixed tabbing between list cells
2 parents 2fb909d + f2d1fba commit f889a7f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/watchers/ListCell.as

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ public class ListCell extends Sprite {
6767
addChild(tf);
6868
}
6969

70+
public function select():void {
71+
stage.focus = tf;
72+
tf.setSelection(0, tf.getLineLength(0));
73+
}
74+
7075
}}

src/watchers/ListWatcher.as

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,14 @@ public class ListWatcher extends Sprite {
523523
if (cell.tf == cellContents) {
524524
e.preventDefault();
525525
if (contents.length < 2) return; // only one cell, and it's already selected
526-
if ((i + 1) < visibleCells.length) {
527-
stage.focus = visibleCells[i + 1];
526+
if (i + 1 < visibleCells.length) {
527+
visibleCells[i + 1].select();
528528
return;
529529
} else {
530530
var selectIndex:int = (firstVisibleIndex + i + 1) % contents.length;
531531
scrollToIndex(selectIndex);
532532
var j:int = firstVisibleIndex - selectIndex;
533-
if ((j >= 0) && (j < visibleCells.length)) stage.focus = visibleCells[j];
533+
if (j >= 0 && j < visibleCells.length) visibleCells[j].select();
534534
}
535535
}
536536
}

0 commit comments

Comments
 (0)