Keynav skips masked boxes

This commit is contained in:
Sasha Koshka 2024-07-26 20:49:10 -04:00
parent 9729e3dfda
commit 192e6c6235

View File

@ -287,13 +287,26 @@ func (this *Hierarchy) considerMaskingParents (box anyBox) anyBox {
return box return box
} }
func (this *Hierarchy) isMasked (box anyBox) bool {
parent := box.getParent()
for {
parentBox, ok := parent.(anyBox)
if !ok { break }
if parent.masks() {
return true
}
parent = parentBox.getParent()
}
return false
}
func (this *Hierarchy) focusNext () { func (this *Hierarchy) focusNext () {
found := !this.anyFocused() found := !this.anyFocused()
focused := false focused := false
this.propagateAlt(func (box anyBox) bool { this.propagateAlt(func (box anyBox) bool {
if found { if found {
// looking for the next box to select // looking for the next box to select
if box.canBeFocused() { if box.canBeFocused() && !this.isMasked(box) {
// found it // found it
this.focus(box) this.focus(box)
focused = true focused = true
@ -318,7 +331,7 @@ func (this *Hierarchy) focusPrevious () {
if box == this.focused { if box == this.focused {
return false return false
} }
if box.canBeFocused() { behind = box } if box.canBeFocused() && !this.isMasked(box) { behind = box }
return true return true
}) })
this.focus(behind) this.focus(behind)