Skip to content

feat(fuselage): ensure Button defaults to type="button" to prevent accidental form submissions Body: #1813

@Kalpana-chavhan

Description

@Kalpana-chavhan

Description

Currently, HTML <button> elements default to type="submit" when placed inside a <form>. In a large application like Rocket.Chat, using a Fuselage <Button> for actions like "Cancel" or "Close" inside a form context can lead to unintended submissions if the type is not explicitly set.

Proposed Solution

Modify the Button component to default to type="button" while still allowing developers to explicitly override it with type="submit" or type="reset".

Why this matters

This is a defensive programming pattern that prevents subtle UX bugs. By ensuring buttons are "neutral" by default, we improve the reliability of forms across the Rocket.Chat ecosystem.

Changes

  • Set default type = 'button' in the component props.
  • Ensure the type prop is correctly forwarded to the underlying Box or button element.
  • Maintain support for type="submit" when explicitly provided.

I have analyzed the current Button.tsx implementation and submitted a PR with this safer default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions