-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(select): don't handle open key presses while the user is typing #17785
fix(select): don't handle open key presses while the user is typing #17785
Conversation
We support typing into a select to skip to an item, as well as pressing space to open the select, however if the user is typing something that has a space in it, the select will open and interrupt the user. These changes add some logic so that we don't trigger the panel while the user is typing. Fixes angular#17774.
5821492
to
4988d09
Compare
I've reworked it based on the feedback @jelbourn. |
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
it('should expose whether the user is currently typing', fakeAsync(() => { | ||
expect(keyManager.isTyping()).toBe(false); | ||
|
||
keyManager.onKeydown(createKeyboardEvent('keydown', 79, 'o')); // types "o" |
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.
out of curiosity: why not using cdk/keycodes
for the O
keycode? (for consistency)
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.
Nevermind.. I see other tests in this file hardcode the codes too.
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.
I think most of the tests in this file were written before we added as many constants to the CDK.
…tion list Along the same lines as angular#17785. Doesn't handle space key presses while the user is using the typeahead so that we don't interrupt their typing.
…tion list Along the same lines as angular#17785. Doesn't handle space key presses while the user is using the typeahead so that we don't interrupt their typing.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
We support typing into a select to skip to an item, as well as pressing space to open the select, however if the user is typing something that has a space in it, the select will open and interrupt the user. These changes add some logic so that we don't trigger the panel while the user is typing.
Fixes #17774.