(inputId: string, remainingFrames = 30)
| 46 | }; |
| 47 | |
| 48 | const focusInputById = (inputId: string, remainingFrames = 30): void => { |
| 49 | if (typeof document === 'undefined') { |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | const input = document.getElementById(inputId); |
| 54 | if (input) { |
| 55 | input.focus(); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | if (remainingFrames <= 0) { |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | requestAnimationFrame(() => focusInputById(inputId, remainingFrames - 1)); |
| 64 | }; |
| 65 | |
| 66 | export interface NewCommentRef { |
| 67 | onShowInput: (origin: Origin) => void; |