Skip to content

Buttons have implicit type="submit" #23734

Open
@envy

Description

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

My password manager is detecting login forms and is covering them with an overlay showing my logins for that site. I can select one and the credentials are automatically filled in and the submit button is pressed.

On the cloud login site, there technically is no form, so the password manager is trying to figure out which button is the submit button. The problem is, that all of them are. All <button> tags are missing the type attribute which causes browsers to default to type="submit": https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type

I tried to fix this myself, but my webdev skills are pretty bad so here is what I figured out:

  • HA uses its own components based on material web components.
  • The ha-button component derives from material/mwc-button which seems to have no way of actually specify the button type.
  • Same with ha-icon-button deriving from material/mwc-icon-button.
  • Both material/mwc-button and material/mwc-icon-button are actually deprecated and are now provided by material/web which HA actually also uses.
  • The button in material/web has a type property which is what needs to be set, same for the iconbutton.

And now my webdev skills are exhausted as I think it would be necessry to change ha-button and ha-icon-button to use material/web's implementations without breaking anything.

Describe the behavior you expected

Buttons that are not submit buttons should have type="button".

Steps to reproduce the issue

Inspect any button in HA and notice that there is no type attribute.

What version of Home Assistant Core has the issue?

2025.1.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue?

No response

Which operating system are you using to run this browser?

No response

State of relevant entities

Problem-relevant frontend configuration

Javascript errors shown in your browser console/inspector

Additional information

No response

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