Skip to content

Commit 36faffb

Browse files
committed
stop tabs from changing focus in TextArea
1 parent 0f7c7c0 commit 36faffb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

haxe/ui/backend/TextInputBase.hx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ class TextInputBase extends TextDisplayBase {
3737
el.style.position = "absolute";
3838
el.style.backgroundColor = "inherit";
3939
el.style.whiteSpace = "nowrap";
40+
el.onkeydown = function(e) {
41+
if (e.keyCode == 9 || e.which == 9) {
42+
trace("here");
43+
e.preventDefault();
44+
e.stopImmediatePropagation();
45+
e.stopPropagation();
46+
47+
var ta:TextAreaElement = cast(el, TextAreaElement);
48+
var s = ta.selectionStart;
49+
ta.value = ta.value.substring(0, ta.selectionStart) + "\t" + ta.value.substring(ta.selectionEnd);
50+
ta.selectionEnd = s + 1;
51+
52+
53+
return false;
54+
}
55+
return true;
56+
}
4057
}
4158
return el;
4259
}

0 commit comments

Comments
 (0)