MCPcopy Create free account
hub / github.com/dailydotdev/apps / focusInputById

Function focusInputById

packages/shared/src/components/post/NewComment.tsx:48–64  ·  view source on GitHub ↗
(inputId: string, remainingFrames = 30)

Source from the content-addressed store, hash-verified

46};
47
48const 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
66export interface NewCommentRef {
67 onShowInput: (origin: Origin) => void;

Callers 1

onCommentClickFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected