Skip to content

Autocomplete: don't prevent keypress for multiline (Firefox) #940

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

Closed
wants to merge 4 commits into from

Conversation

MoonScript
Copy link

Fixes #8911 - autocomplete: Unable to use up/down arrow keys in a textarea (Firefox)

Jason Moon added 4 commits May 7, 2012 11:15
… Fixed #8301 - Placeholder doesn't move when using connectWith option
…d lists. Fixed #8301 - Placeholder doesn't move when using connectWith option"

This reverts commit 96d5f18.
…ocomplete: Unable to use up/down arrow keys in a textarea (Firefox)
@@ -142,7 +142,9 @@ $.widget( "ui.autocomplete", {
keypress: function( event ) {
if ( suppressKeyPress ) {
suppressKeyPress = false;
event.preventDefault();
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is the visibility check necessary here?

Copy link
Author

Choose a reason for hiding this comment

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

So when it's multiline (textarea), we only want to preventDefault when the autocomplete menu is visible. Otherwise, we can't use up/down arrows in the textarea in Firefox when the autocomplete menu is hidden (normal textarea keyboard navigation).

Copy link
Member

Choose a reason for hiding this comment

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

Right, I think I'm getting confused because I'm not seeing a difference if we remove the visibility check. The logic makes sense, and I'm sure if I spent enough time I'd find something that would break without it. So I'm just going to land this :-)

@scottgonzalez
Copy link
Member

Thanks, landed in f5f0879.

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

Successfully merging this pull request may close these issues.

2 participants