register method

void register(
  1. String id, {
  2. String? parentId,
  3. bool focusable = true,
})

Registers a parent-child relationship for focus IDs to support bubbling.

If focusable is true, the ID is added to the navigation order.

Implementation

void register(String id, {String? parentId, bool focusable = true}) {
  if (id == parentId) return; // Prevent cycles
  if (TuiTrace.enabled) {
    TuiTrace.log(
      'focus.register id=$id parentId=$parentId focusable=$focusable ids=$_focusableIds',
    );
  }
  _parents[id] = parentId;
  if (focusable && !_focusableIds.contains(id)) {
    _focusableIds.add(id);
  }
}