Skip to content

Commit

Permalink
Merge pull request #13 from ardangelo/fix-setfocused
Browse files Browse the repository at this point in the history
No break in SetFocused loop applies old focus after exiting
  • Loading branch information
tulir authored Dec 9, 2024
2 parents f020cbb + 7010723 commit 5200d71
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions flex.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ func (flex *Flex) OnPasteEvent(event PasteEvent) bool {
}

func (flex *Flex) SetFocused(comp Component) {
for _, child := range flex.children {
if child.target == comp {
flex.focused = &child
for i := range flex.children {
childp := &flex.children[i]
if childp.target == comp {
flex.focused = childp
flex.focused.Focus()
break
}
}
}
Expand Down

0 comments on commit 5200d71

Please sign in to comment.