diff options
author | 2021-02-08 19:29:37 +0200 | |
---|---|---|
committer | 2021-02-08 19:29:37 +0200 | |
commit | 7075e8579e5aa038438be9bbb2ba275d52c20910 (patch) | |
tree | 87140512e8d6d4cdebb88b40e76f741c7dae38db /src/components/Question.tsx | |
parent | Rename invalid field IDs variable (diff) |
Implement focusing text fields if empty on submit
Diffstat (limited to 'src/components/Question.tsx')
-rw-r--r-- | src/components/Question.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/components/Question.tsx b/src/components/Question.tsx index 567da2c..e619a45 100644 --- a/src/components/Question.tsx +++ b/src/components/Question.tsx @@ -18,7 +18,9 @@ const skip_normal_state: Array<QuestionType> = [ export type QuestionProp = { question: Question, public_state: Map<string, string | boolean | null>, - scroll_ref: React.RefObject<HTMLDivElement> + scroll_ref: React.RefObject<HTMLDivElement>, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + focus_ref: React.RefObject<any> } class RenderedQuestion extends React.Component<QuestionProp> { @@ -256,7 +258,7 @@ class RenderedQuestion extends React.Component<QuestionProp> { <h2 css={[selectable, requiredStarStyles]}> {question.name}<span className={question.required ? "required" : ""}>*</span> </h2> - { create_input(this.props, this.handler, this.blurHandler) } + { create_input(this.props, this.handler, this.blurHandler, this.props.focus_ref) } <ErrorMessage show={!valid} message={error} /> <hr css={css`color: gray; margin: 3rem 0;`}/> </div>; |