mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-27 01:50:44 +00:00
form: do not focus invisible elements.
This commit is contained in:
parent
f2ec07fd1c
commit
9673eaf517
@ -4397,16 +4397,21 @@ Form.prototype.next = function() {
|
||||
|
||||
if (!this._selected) {
|
||||
this._selected = this._children[0];
|
||||
if (!this._selected.visible) return this.next();
|
||||
// return this._selected;
|
||||
if (this.screen.focused !== this._selected) return this._selected;
|
||||
}
|
||||
|
||||
var i = this._children.indexOf(this._selected);
|
||||
if (!~i || !this._children[i + 1]) {
|
||||
return this._selected = this._children[0];
|
||||
this._selected = this._children[0];
|
||||
if (!this._selected.visible) return this.next();
|
||||
return this._selected;
|
||||
}
|
||||
|
||||
return this._selected = this._children[i + 1];
|
||||
this._selected = this._children[i + 1];
|
||||
if (!this._selected.visible) return this.next();
|
||||
return this._selected;
|
||||
};
|
||||
|
||||
Form.prototype.previous = function() {
|
||||
@ -4414,16 +4419,21 @@ Form.prototype.previous = function() {
|
||||
|
||||
if (!this._selected) {
|
||||
this._selected = this._children[this._children.length - 1];
|
||||
if (!this._selected.visible) return this.previous();
|
||||
// return this._selected;
|
||||
if (this.screen.focused !== this._selected) return this._selected;
|
||||
}
|
||||
|
||||
var i = this._children.indexOf(this._selected);
|
||||
if (!~i || !this._children[i - 1]) {
|
||||
return this._selected = this._children[this._children.length - 1];
|
||||
this._selected = this._children[this._children.length - 1];
|
||||
if (!this._selected.visible) return this.previous();
|
||||
return this._selected;
|
||||
}
|
||||
|
||||
return this._selected = this._children[i - 1];
|
||||
this._selected = this._children[i - 1];
|
||||
if (!this._selected.visible) return this.previous();
|
||||
return this._selected;
|
||||
};
|
||||
|
||||
Form.prototype.focusNext = function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user