(modal)
| 431 | } |
| 432 | |
| 433 | function focusFirstInModal(modal) { |
| 434 | if (!modal || !document.body.contains(modal)) return; |
| 435 | if (modal.contains(document.activeElement)) return; |
| 436 | const focusables = getFocusableElements(modal); |
| 437 | if (focusables.length) { |
| 438 | focusables[0].focus({ preventScroll: true }); |
| 439 | } else { |
| 440 | modal.focus({ preventScroll: true }); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | function trapFocusInModal(modal) { |
| 445 | if (!modal || modal.__frTrapBound) return; |
no test coverage detected