mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
Fix: Auto-activate first section and auto-focus first element on register
- When first focusable component registers, auto-activate its section - First element in active section auto-focuses (macOS/SwiftUI behavior) - Enables Tab navigation between groups from the start - All 591 tests passing
This commit is contained in:
@@ -168,7 +168,10 @@ public extension FocusManager {
|
||||
guard let section = section(id: targetID) else { return }
|
||||
section.register(element)
|
||||
|
||||
// Auto-focus first element in the active section
|
||||
// Auto-activate section and auto-focus first element if needed
|
||||
if activeSectionID == nil {
|
||||
activeSectionID = targetID
|
||||
}
|
||||
if targetID == activeSectionID && focusedID == nil && element.canBeFocused {
|
||||
focus(element)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user