Skip to content

Commit

Permalink
chore: clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Zeinstra committed Aug 18, 2023
1 parent f197c35 commit 0fb2adf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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 (
<>
Expand All @@ -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 && (
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -51,14 +51,6 @@ const SelectQuestion = ({
}
}, [options]);

const inputRef = useRef(null);
useEffect(() => {
const input: any = inputRef?.current;
if (input && error) {
input.focus();
}
}, [error]);

return (
<Wrapper>
<Question
Expand All @@ -78,7 +70,6 @@ const SelectQuestion = ({
data-testid={name}
tabIndex={1}
autoFocus={autoFocus}
ref={inputRef}
>
<option disabled value="">
...
Expand Down

0 comments on commit 0fb2adf

Please sign in to comment.