From 0fb2adf7e6e53c2c5da3361c791dbfebbb2914bf Mon Sep 17 00:00:00 2001 From: Victor Zeinstra Date: Fri, 18 Aug 2023 12:50:23 +0200 Subject: [PATCH] chore: clean --- .../src/outils/Components/RadioQuestion.tsx | 10 +--------- .../src/outils/Components/SelectQuestion.tsx | 11 +---------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/code-du-travail-frontend/src/outils/Components/RadioQuestion.tsx b/packages/code-du-travail-frontend/src/outils/Components/RadioQuestion.tsx index 41ede18aec..e5c7de0683 100644 --- a/packages/code-du-travail-frontend/src/outils/Components/RadioQuestion.tsx +++ b/packages/code-du-travail-frontend/src/outils/Components/RadioQuestion.tsx @@ -1,5 +1,5 @@ import { Fieldset, InputRadio } from "@socialgouv/cdtn-ui"; -import React, { useEffect, useRef } from "react"; +import React from "react"; import styled from "styled-components"; import Html from "../../common/Html"; @@ -44,13 +44,6 @@ export default function RadioQuestion({ const onChange = (value: string) => { onChangeSelectedOption(value); }; - const inputRef = useRef(null); - useEffect(() => { - const input: any = inputRef?.current; - if (input && error) { - input.focus(); - } - }, [error]); return ( <> @@ -72,7 +65,6 @@ export default function RadioQuestion({ onChange={() => onChange(question.value)} tabIndex={1} autoFocus={autoFocus ? index === 0 : false} - ref={index === 0 ? inputRef : undefined} /> ))} {error && ( diff --git a/packages/code-du-travail-frontend/src/outils/Components/SelectQuestion.tsx b/packages/code-du-travail-frontend/src/outils/Components/SelectQuestion.tsx index d9e735e86a..6cd23e2267 100644 --- a/packages/code-du-travail-frontend/src/outils/Components/SelectQuestion.tsx +++ b/packages/code-du-travail-frontend/src/outils/Components/SelectQuestion.tsx @@ -1,5 +1,5 @@ import { Select, theme } from "@socialgouv/cdtn-ui"; -import React, { useEffect, useRef } from "react"; +import React from "react"; import styled from "styled-components"; import Html from "../../common/Html"; import { InlineError } from "../common/ErrorField"; @@ -51,14 +51,6 @@ const SelectQuestion = ({ } }, [options]); - const inputRef = useRef(null); - useEffect(() => { - const input: any = inputRef?.current; - if (input && error) { - input.focus(); - } - }, [error]); - return (