Skip to content

fix(web-components/file-input): trash icon remains visible when error=true #419

@saraparsa13

Description

@saraparsa13

Description:

After the file-upload API call fails and the error prop is set to true on the file-input component, the error styling and message appear correctly, but the trash (clear) icon remains visible. This allows users to attempt to clear a file that never successfully uploaded, causing confusion.

To Reproduce:

  1. Render:
<TapsiFileInput
  label="upload the image"
  hideLabel
  placeholder="upload the image"
  accept="image/*"
  disabled={isPending}
  loading={isPending}
  onInput={handleUploadFile}
  error={isError}
  errorText="error on uploading the image,please try again!"
/>
  1. Simulate a failed upload by rejecting the API call and setting isError === true.
  2. Observe that the error styling and text appear, and the trash icon is still rendered.

Expected behavior:

When error={true} (i.e. upload failed), the component should:

  • Display the error message
  • Hide the trash/clear icon, since there is no valid file to clear.

Desktop:

  • OS: macOS 14.4.1
  • Browser: Chrome 135
  • @tapsioss/web‑components: v0.11.1

Screen Record:

Screen.Recording.1404-01-31.at.12.29.08.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions