FocusManager
The default {@see FocusManagerInterface} implementation: modulo-wrapped rotation through a deduplicated, non-empty-string-only id list. `$index` is clamped into range at construction and on every rotation, so it can never point outside {@see ids()} even if constructed with an out-of-range starting index.
FocusManager::__construct()
public function __construct(array $ids = [], int $index = 0):Parameters
| Name | Type | Description |
|---|---|---|
| $ids | array<int, string> | The focusable ids to rotate through. Deduplicated and stripped of empty strings before use. |
| $index | int | Starting position into `$ids`, clamped into range. |
FocusManager::currentId()
public function currentId(): ?stringThe id currently holding focus, or null when nothing does.
FocusManager::focus()
public function focus(string $id): voidMoves focus to this id, if it is part of the focus order.
Parameters
| Name | Type | Description |
|---|---|---|
| $id | string |
FocusManager::next()
public function next(): ?stringMoves focus to the next id in order and returns it, wrapping at the end.
FocusManager::previous()
public function previous(): ?stringMoves focus to the previous id in order and returns it, wrapping at the start.
FocusManager::ids()
public function ids(): array