Skip to content

Add type="button" to controls in mat-calendar #10514

Closed
@DAquilina

Description

@DAquilina

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Clicking a calendar button should interact with the calendar and not the parent form

What is the current behavior?

Clicking a calendar button submits the wrapping form

What are the steps to reproduce?

  1. Put a mat-calendar inside a form with a submit handler
  2. Click next or previous

https://angular-material2-issue-zi9txa.stackblitz.io

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Tested with latest in ng2 (6.0.0-beta.7) and material2 (6.0.0-beta.4), as well as ng5.2.4 and material 5.2.1. I've been using OSX 10.13.3/Chrome but I guarantee that this will happen in any modern browser.

Is there anything else we should know?

By default, the type of a button element in HTML is set to "submit", so when it is clicked it will submit the form regardless of what click handlers get invoked.

Metadata

Metadata

Labels

P2The issue is important to a large percentage of users, with a workaroundhelp wantedThe team would appreciate a PR from the community to address this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions