focus method

  1. @override
void focus()
override

Item/component focuses itself

Implementation

@override
void focus() {
  // Although this focus() triggers a reflow, wrapping it with scheduleWrite()
  // adds 50-100 ms to latency because the animation frame doesn't get
  // triggered for a long time (since the main calendar init takes 100+ ms,
  // requestAnimationFrame() tries to render at 10 fps).
  if (_elementRef.querySelector('.preset-list') != null) {
    _elementRef
        .querySelector('.preset-list material-select-item.selected')
        ?.focus();
  } else {
    _elementRef.querySelector('material-input.active input')?.focus();
  }
}