Skip to content

Commit

Permalink
Justering av fokus-eksempel på ErrorSummary (#2577)
Browse files Browse the repository at this point in the history
  • Loading branch information
HalvorHaugan authored Dec 21, 2023
1 parent a4eca33 commit 6f53780
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Button, ErrorSummary } from "@navikt/ds-react";
import { withDsExample } from "@/web/examples/withDsExample";

const Example = () => {
const errorRef = useRef(null);
const errorRef = useRef<HTMLDivElement>(null);
const [hasError, setHasError] = useState(false);

useEffect(() => {
errorRef?.current && errorRef.current.focus();
errorRef.current && errorRef.current.focus();
}, [hasError]);

return (
Expand Down Expand Up @@ -40,4 +40,5 @@ export const Demo = {

export const args = {
index: 3,
desc: "Sett fokus på ErrorSummary ved submit. Hvis du gjør en ny sidelasting kan du også sette en ID på ErrorSummary og referere til den i URLens hash.",
};

0 comments on commit 6f53780

Please sign in to comment.