Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DAquilina opened this issue Mar 21, 2018 · 1 comment · Fixed by #10515
Closed

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

DAquilina opened this issue Mar 21, 2018 · 1 comment · Fixed by #10515
Assignees
Labels
help wanted The team would appreciate a PR from the community to address this issue P2 The issue is important to a large percentage of users, with a workaround

Comments

@DAquilina
Copy link

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.

@mmalerba mmalerba added P2 The issue is important to a large percentage of users, with a workaround help wanted The team would appreciate a PR from the community to address this issue labels Mar 21, 2018
@crisbeto crisbeto self-assigned this Mar 21, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 21, 2018
…uttons

Sets all internal calendar buttons to be `type="button"` in order to avoid accidental submissions if the calendar is placed inside a form.

Fixes angular#10514.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 27, 2018
…uttons

Sets all internal calendar buttons to be `type="button"` in order to avoid accidental submissions if the calendar is placed inside a form.

Fixes angular#10514.
jelbourn pushed a commit that referenced this issue Apr 6, 2018
…uttons (#10515)

Sets all internal calendar buttons to be `type="button"` in order to avoid accidental submissions if the calendar is placed inside a form.

Fixes #10514.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted The team would appreciate a PR from the community to address this issue P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants