Skip to content

Commit

Permalink
FileUpload.Dropzone: id prop settes på button (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
HalvorHaugan authored Mar 22, 2024
1 parent b6086f7 commit d991011
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-seahorses-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-react": patch
---

FileUpload.Dropzone: id prop settes på button
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Dropzone = forwardRef<HTMLInputElement, FileUploadDropzoneProps>(
disabled,
translations,
onClick,
id: buttonId,
...rest
} = props;

Expand All @@ -46,7 +47,10 @@ const Dropzone = forwardRef<HTMLInputElement, FileUploadDropzoneProps>(
const _disabled = disabled ?? fileLimitReached;

const { inputProps, errorId, showErrorMsg, hasError, inputDescriptionId } =
useFormField({ ...props, disabled: _disabled }, "fileUpload");
useFormField(
{ ...omit(props, ["id"]), disabled: _disabled },
"fileUpload",
);
const {
id: inputId,
"aria-describedby": ariaDescribedby,
Expand Down Expand Up @@ -129,8 +133,9 @@ const Dropzone = forwardRef<HTMLInputElement, FileUploadDropzoneProps>(
<BodyShort as="div">{translate("dropzone.or")}</BodyShort>
</div>
<Button
{...omit(rest, ["errorId", "id"])}
{...omit(rest, ["errorId"])}
{...inputPropsRest}
id={buttonId}
aria-describedby={cl(labelId, ariaDescribedby)}
className="navds-dropzone__area-button"
type="button"
Expand Down

0 comments on commit d991011

Please sign in to comment.