Side navigation
#1065 closed bug (wontfix)
Opened March 23, 2007 12:54AM UTC
Closed March 31, 2008 02:13AM UTC
Tab in interface brings to top of textarea
Reported by: | kanno41 | Owned by: | stefan |
---|---|---|---|
Priority: | minor | Milestone: | 1.1.3 |
Component: | interface | Version: | 1.1.2 |
Keywords: | tab | Cc: | |
Blocked by: | Blocking: |
Description
While using the Tabbing feature of the interface plugin when there is a scrollbar, it tabs over but scrolls to the top of the textarea at the same time.
Attachments (0)
Change History (3)
Changed March 30, 2007 01:17PM UTC by comment:1
Changed March 30, 2007 01:26PM UTC by comment:2
Sorry about ugly Javascript, here's the syntax highlighted version
#!js doTab : function(e) { var sct = this.scrollTop; var l = this.value.length; pressedKey = e.charCode || e.keyCode || -1; if (pressedKey == 9) { if (window.event) { window.event.cancelBubble = true; window.event.returnValue = false; } else { e.preventDefault(); e.stopPropagation(); } if (this.createTextRange) { var range = document.selection.createRange(); range.text=" "; range.moveStart("character", -1); // this.onblur = function() { this.focus(); this.onblur = null; }; } else if (this.setSelectionRange) { start = this.selectionStart; end = this.selectionEnd; this.value = this.value.substring(0, start) + " " + this.value.substr(end); this.setSelectionRange(start + 1, start + 1); this.scrollTop = sct; // this.focus(); } return false; } }
I found a code somewhere, that fixes this issue, can't find a bookmark at the moment.
I made following changes to ittabs.js
var sct = this.scrollTop;
var l = this.value.length;
pressedKey = e.charCode || e.keyCode || -1;
if (pressedKey == 9) {
if (window.event) {
window.event.cancelBubble = true;
window.event.returnValue = false;
} else {
e.preventDefault();
e.stopPropagation();
}
if (this.createTextRange) {
var range = document.selection.createRange();
range.text=" ";
range.moveStart("character", -1);
this.onblur = function() { this.focus(); this.onblur = null; };
} else if (this.setSelectionRange) {
start = this.selectionStart;
end = this.selectionEnd;
this.value = this.value.substring(0, start) + " " + this.value.substr(end);
this.setSelectionRange(start + 1, start + 1);
this.scrollTop = sct;
this.focus();
}
This works in Firefox 2 and in IE7. Dunno about other browsers.