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 option to clear input field on pressing escape #237

Merged
merged 2 commits into from
Jun 16, 2020

Conversation

nischi
Copy link
Contributor

@nischi nischi commented Jun 15, 2020

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

Copy link
Member

@macjohnny macjohnny left a 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) {
Copy link
Member

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

Copy link
Contributor Author

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 :)

@nischi
Copy link
Contributor Author

nischi commented Jun 15, 2020

added the configuration

Copy link
Member

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@macjohnny macjohnny changed the title 231 add special case for escape to empty out input field add option to clear input field on pressing escape Jun 15, 2020
@macjohnny macjohnny added this to the 2.3.0 milestone Jun 15, 2020
@nischi
Copy link
Contributor Author

nischi commented Jun 15, 2020

awesome, do you allready know by when it goes to an official release?

@macjohnny
Copy link
Member

@nischi it should be released later today

@nischi
Copy link
Contributor Author

nischi commented Jun 15, 2020

excellent, thanks a lot

@macjohnny macjohnny merged commit f20215c into bithost-gmbh:master Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] On press ESC only empty search field
3 participants