You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Knoxvillekm as workaround you can use this: <form action="" method="POST" (keydown.enter)="$event.preventDefault()">
But keep in mind that it will prevent default behavior for all elements. As an example in textarea it won't trigger new line when hit enter. For avoiding it put an exception in a function like so:
if (event.target.type !== 'textarea') {
event.preventDefault();
}
Reacted by Oshri Ifrah, Shenbo and bogdan-panteleev-mifort
@oshri551mdInput is different beast. It should submit form when hitting Enter from regular INPUT fields. Unlike in TEXTAREA where you need Enter for paragraph.
And unlike in combo/select and here (autocomplete) where hitting Enter should select activated option but by all means should not submit form.
I was about to file an issue and found this one instead. +1
Activity
sumpton commentedon Feb 17, 2017
I am not sure I understand what @Knoxvillekm is after, but it likely relates to my question.
Are there plans for something like a "change" Output in md-select, or "selectItem" I am currently using in
szykov commentedon Feb 18, 2017
@Knoxvillekm as workaround you can use this:
<form action="" method="POST" (keydown.enter)="$event.preventDefault()">But keep in mind that it will prevent default behavior for all elements. As an example in textarea it won't trigger new line when hit enter. For avoiding it put an exception in a function like so:
frankspin89 commentedon Mar 6, 2017
This is indeed a bug in my opinion. When using enter on autocomplete field, it needs to prevent submitting the form.
jefersonestevo commentedon Mar 16, 2017
I agree with @frankspin89 that the enter should not submit the form. I think that it should just select the option like the md-select does.
oshri551 commentedon Mar 20, 2017
I think the same thing exist in mdInput so it's probably related
xuanshenbo commentedon Mar 21, 2017
This is definitely a bug. If ENTER does not trigger submit in a textarea, it shouldn't either for autocomplete
PeS82 commentedon Mar 22, 2017
@oshri551
mdInputis different beast. It should submit form when hitting Enter from regular INPUT fields. Unlike in TEXTAREA where you need Enter for paragraph.And unlike in combo/select and here (autocomplete) where hitting Enter should select activated option but by all means should not submit form.
I was about to file an issue and found this one instead. +1
fix(autocomplete): do not trigger submit on ENTER
jefersonestevo commentedon Mar 22, 2017
I've created the PR #3727 that fixes this behavior and if the material team think that it's ok we may get that fixed soon
frankspin89 commentedon Mar 22, 2017
@jefersonestevo Thank you sir. Hoping that your pr is merged soon.
fix(autocomplete): do not trigger submit on ENTER (#3727)
sync from upstream (#1)
angular-automatic-lock-bot commentedon Sep 5, 2019
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.