-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for alt+up/alt+down to expand/collapse. Don't expose drop…
…down arrow to assistive tech
- Loading branch information
Showing
1 changed file
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,8 +281,6 @@ | |
this.taggerSuggestionsButton = $('<div>') | ||
.addClass('droparrow') | ||
.addClass('hittarget') | ||
.attr('aria-label', 'Toggle option display') | ||
.attr('role', 'button') | ||
.bind('mouseup keyup', $.proxy(this._handleSuggestionsButtonInteraction, this)) | ||
.appendTo(this.taggerButtonsPanel); | ||
$('<img>') | ||
|
@@ -303,8 +301,6 @@ | |
.appendTo(this.taggerSuggestionsButton); | ||
} | ||
|
||
this.taggerSuggestionsButton.attr("tabindex", this.tabIndex); | ||
|
||
// Add placeholder text to text input field | ||
if (this.options.placeholder !== null) { | ||
this.taggerInput.attr("placeholder", this.options.placeholder); | ||
|
@@ -325,6 +321,13 @@ | |
// Select the widget itself again | ||
this._getWidgetFocusable().focus(); | ||
} | ||
|
||
if (event.target && event.altKey && (event.which === this.keyCodes.DOWN || event.which === this.keyCodes.UP)) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
matteason
Author
Member
|
||
this._toggleShowSuggestions(); | ||
|
||
// Select the widget itself again | ||
this._getWidgetFocusable().focus(); | ||
} | ||
}, this)); | ||
|
||
// Capture the keypress event for any child elements - redirect any chars to the current input field | ||
|
@@ -574,7 +577,7 @@ | |
} | ||
} | ||
else if (event.which === this.keyCodes.DOWN) { // Down Arrow | ||
if (isMainInput) { | ||
if (isMainInput && !event.altKey) { | ||
if (!this.options.ajaxURL || this.taggerSuggestions.is(":visible")) { | ||
this._showSuggestions(true); | ||
} | ||
|
@@ -613,19 +616,28 @@ | |
this.taggerWidget.find("input[tabindex]:visible").first().focus(); | ||
} | ||
else { | ||
// If the suggestion list is visible already, then toggle it off | ||
if (this.taggerSuggestions.is(":visible")) { | ||
this._hideSuggestions(); | ||
} | ||
// otherwise show it | ||
else { | ||
this._showSuggestions(true); | ||
} | ||
this._toggleShowSuggestions(); | ||
} | ||
event.preventDefault(); | ||
} | ||
}, | ||
|
||
/** | ||
* Toggle whether suggestions are shown or not | ||
* | ||
* @private | ||
*/ | ||
_toggleShowSuggestions: function() { | ||
// If the suggestion list is visible already, then toggle it off | ||
if (this.taggerSuggestions.is(":visible")) { | ||
this._hideSuggestions(); | ||
} | ||
// otherwise show it | ||
else { | ||
this._showSuggestions(true); | ||
} | ||
}, | ||
|
||
/** | ||
* When keypress events fire on the tagger widget redirect them to the filter input | ||
* | ||
|
Functionality-wise I'd presume one would show and one would hide. Looks like this will toggle both ways using both keys, are you happy with that? I guess ALT+UP kind of gestures expanding, but as it expands down so could ALT+DOWN