Skip to content

UFileUpload with variant button inside form will cause UForm submit #4935

@Kiansa

Description

@Kiansa

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Package

v3.x

Version

v3.3.3

Reproduction

https://codesandbox.io/p/devbox/zen-euclid-cf554n

Description

The problem occurs because the UFileUpload component likely contains a button element that doesn't have an explicit type attribute, causing it to default to type="submit", which triggers form submission.

Additional context

<component
  :is="variant === 'button' ? 'button' : 'div'"
  ref="dropzoneRef"
  :type="variant === 'button' ? 'button' : undefined" // 👈 add this maybe?
  :role="variant === 'button' ? undefined : 'button'"
  :data-dragging="isDragging"
  :class="ui.base({ class: props.ui?.base })"
  :tabindex="interactive && !disabled ? 0 : -1"
  @click="interactive && !disabled && open()" 
  @keydown.prevent
  @keyup.enter.space="interactive && !disabled && open()"
>

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions