Skip to content

Attribute type is missing in button #206

@spacecat

Description

@spacecat

The generated markup looks like this:

<button class="easy-edit-button" name="edit">Edit</button>

By default a button has type submit. Which is not what we're dealing with when clicking the Edit button. So it should have type="button" as the default.

From ChatGPT:

In HTML, the type attribute on a <button> element is not strictly required, but it is recommended to specify it for clarity and to avoid potential unintended behavior. The type attribute can have three possible values:

  • submit (default): Submits the form data.
  • button: Acts as a general-purpose button (does nothing by default).
  • reset: Resets the form data.

If you don't specify a type, the button will default to submit in a form context. This can be problematic if you intended it to be a general-purpose button, as it could accidentally submit a form when clicked. To avoid this, it's a good practice to explicitly set the type attribute.

For example:

<button type="button">Click me</button>

This ensures the button won't submit a form unless you want it to.

Edit: Same with Save and Cancel buttons. And probably all other buttons as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions