From 7075e8579e5aa038438be9bbb2ba275d52c20910 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 19:29:37 +0200 Subject: Implement focusing text fields if empty on submit --- src/components/Question.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/components/Question.tsx') 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 = [ export type QuestionProp = { question: Question, public_state: Map, - scroll_ref: React.RefObject + scroll_ref: React.RefObject, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + focus_ref: React.RefObject } class RenderedQuestion extends React.Component { @@ -256,7 +258,7 @@ class RenderedQuestion extends React.Component {

{question.name}*

- { create_input(this.props, this.handler, this.blurHandler) } + { create_input(this.props, this.handler, this.blurHandler, this.props.focus_ref) }
; -- cgit v1.2.3