Skip to content

Commit

Permalink
Disable autocomplete on TextInput & InputField (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpierre authored Feb 11, 2025
1 parent 39f55da commit d116669
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions frontend/uikit/src/Input/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import type { ComponentPropsWithoutRef } from "react";

import { useId } from "react";
import { css, cx } from "../../styled-system/css";

export function TextInput({
Expand All @@ -11,13 +12,15 @@ export function TextInput({
}: Omit<ComponentPropsWithoutRef<"input">, "onChange"> & {
onChange?: (value: string) => void;
}) {
const id = useId();
return (
<input
type="text"
{...props}
onChange={(event) => {
onChange?.(event.target.value);
}}
name={`input-${id}`}
className={cx(
css({
width: "100%",
Expand Down
4 changes: 2 additions & 2 deletions frontend/uikit/src/InputField/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import type { ReactNode } from "react";

import { a, useSpring, useTransition } from "@react-spring/web";
import { useEffect, useState } from "react";
import { forwardRef, useId, useRef } from "react";
import { forwardRef, useEffect, useId, useRef, useState } from "react";
import { css, cx } from "../../styled-system/css";
import { IconCross } from "../icons";
import { useElementSize } from "../react-utils";
Expand Down Expand Up @@ -248,6 +247,7 @@ const InputField = forwardRef<HTMLInputElement, {
<input
ref={ref}
id={id}
name={autoId}
disabled={disabled}
onBlur={() => {
setFocused(false);
Expand Down

0 comments on commit d116669

Please sign in to comment.