-
-
Notifications
You must be signed in to change notification settings - Fork 133
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 option to clear input field on pressing escape #237
add option to clear input field on pressing escape #237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your PR!
the new behavior should be configurable and disabled by default
@@ -385,6 +385,12 @@ export class MatSelectSearchComponent implements OnInit, OnDestroy, AfterViewIni | |||
) { | |||
event.stopPropagation(); | |||
} | |||
|
|||
// Special case if click Escape, if input is empty, close the dropdown, if not, empty out the search field | |||
if (event.keyCode === ESCAPE && this.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be enabled only when a corresponding optional input is set, in order to keep the current behavior, e.g.
@Input() enableClearOnEscapePressed = false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay i will change it :)
added the configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
awesome, do you allready know by when it goes to an official release? |
@nischi it should be released later today |
excellent, thanks a lot |
Fixes #231
If you search for something and press ESC it will empty the search input. if search input is empty and you press ESC it fall back to default behaviour