Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Escape and enter should not propagate outside of ui-select #808

Closed
mareczek opened this issue Mar 31, 2015 · 15 comments
Closed

Escape and enter should not propagate outside of ui-select #808

mareczek opened this issue Mar 31, 2015 · 15 comments

Comments

@mareczek
Copy link
Contributor

At present when ui-select is focused escape and enter propagate outside of ui-select.
When escape is pressed while the list of options is opened and the ui-select is displayed in modal the modal closes
or
when enter is pressed while one of the options is highlighted the form is being submitted.

mareczek added a commit to mareczek/ui-select that referenced this issue Mar 31, 2015
@drewfreyling
Copy link

@mareczek I don't think 85cbd70 fixes the enter key press issue FYI.

@mareczek
Copy link
Contributor Author

mareczek commented Apr 7, 2015

@drewfreyling 85cbd70 was i mistake (isn't it obvious?), hence 6b0fd79

@drewfreyling
Copy link

@mareczek That makes a bit more sense now! My apologies.

@mareczek
Copy link
Contributor Author

mareczek commented Apr 8, 2015

@drewfreyling no problem, do you have any knowledge if this can be merged / or when it could be merged?

@drewfreyling
Copy link

Tagging @dimirc for that info...

@kiddo13
Copy link

kiddo13 commented Apr 15, 2015

Got the same problem too.

@mtraynham
Copy link

+1 Pretty big issue if you ask me...

@zbabtkis
Copy link

Yeah. Doesn't this bug make it impossible to include in a form with an ng-submit?

@krema
Copy link

krema commented Apr 16, 2015

👍

@mtraynham
Copy link

@zigzackattack yeah, it does. An enter key press submits the form regardless of validity.
@mareczek's solution worked for me... but it looks like this project is on halt? Nothing committed in a month...

@just-boris
Copy link
Contributor

Pull request to solve it: #901

@manichandra
Copy link

Thanks @mareczek

@MikeMatusz
Copy link

#901 certainly does correct one issue, but it introduces a new one. A control should only consume an event when it actually does something with it. So if pressing enter causes an item to be selected, it should stop propagation, same if pressing escape closes the dropdown. But if the user hasn't typed anything and enter/escape isn't closing the dropdown or selecting an item, it should be allowed to propagate and submit or close the modal. Now you can't ever submit a form if focus is within this control. I can try to get a new pull request put together that would do this.

@oslo10e
Copy link

oslo10e commented Oct 26, 2015

I do agree with @MikeMatusz, enter/escape should trigger default behavior when drop down list is closed. Because it should be possible to submit a FORM that contains ui-select by pressing ENTER,
or closing a modal window that contains ui-select by pressing ESC.
At least it should be an optional attribute of ui-select

@oslo10e
Copy link

oslo10e commented Oct 29, 2015

@MikeMatusz I made a pull request, #1279, to allow submit when pressing ENTER key in ui-select element by adding in-form="true". If you appreciate it, can you vote for it ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants