(element: FocusableElement | null, scroll = false)
| 539 | } |
| 540 | |
| 541 | function focusElement(element: FocusableElement | null, scroll = false) { |
| 542 | if (element != null && !scroll) { |
| 543 | try { |
| 544 | focusSafely(element); |
| 545 | } catch { |
| 546 | // ignore |
| 547 | } |
| 548 | } else if (element != null) { |
| 549 | try { |
| 550 | element.focus(); |
| 551 | } catch { |
| 552 | // ignore |
| 553 | } |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | function getFirstInScope(scope: Element[], tabbable = true): FocusableElement | null { |
| 558 | let sentinel = scope[0].previousElementSibling!; |
no test coverage detected