Skip to content

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

Closed
wants to merge 4 commits into from

2 participants

@MoonScript

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

MoonScript added some commits May 7, 2012
@MoonScript MoonScript Sortable: update placeholder when axis is x or y for connected lists.…
… Fixed #8301 - Placeholder doesn't move when using connectWith option
96d5f18
@MoonScript MoonScript Revert "Sortable: update placeholder when axis is x or y for connecte…
…d lists. Fixed #8301 - Placeholder doesn't move when using connectWith option"

This reverts commit 96d5f18.
f213691
@MoonScript MoonScript Merge branch 'master' of https://github.com/jquery/jquery-ui 54ecfde
@MoonScript MoonScript Autocomplete: don't prevent keypress for multiline. Fixed #8911 - aut…
…ocomplete: Unable to use up/down arrow keys in a textarea (Firefox)
ceaf8b9
@scottgonzalez scottgonzalez commented on the diff Apr 25, 2013
ui/jquery.ui.autocomplete.js
@@ -142,7 +142,9 @@ $.widget( "ui.autocomplete", {
keypress: function( event ) {
if ( suppressKeyPress ) {
suppressKeyPress = false;
- event.preventDefault();
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
@scottgonzalez
jQuery Foundation member

Why is the visibility check necessary here?

@MoonScript
MoonScript added a note Apr 25, 2013

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

@scottgonzalez
jQuery Foundation member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@scottgonzalez
jQuery Foundation member

Thanks, landed in f5f0879.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.