mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-28 13:17:42 +00:00
Improve token field keyboard navigation when tokens are selected.
If one or more token is selected and the left arrow key is pressed, collapse the selection to the left of the first selected token. Similarly, on right arrow key collapse to the right of the last token. Note that shift-left and shift-right have no effect if the first or last token respectively in the field are already selected.
This commit is contained in:
@@ -725,7 +725,7 @@ var CPScrollDestinationNone = 0,
|
||||
- (void)moveLeft:(id)sender
|
||||
{
|
||||
// Left arrow
|
||||
if (_selectedRange.location > 0 && CPTokenFieldDOMInputElement.value == "")
|
||||
if ((_selectedRange.location > 0 || _selectedRange.length) && CPTokenFieldDOMInputElement.value == "")
|
||||
{
|
||||
if (_selectedRange.length)
|
||||
// Simply collapse the range.
|
||||
@@ -762,7 +762,7 @@ var CPScrollDestinationNone = 0,
|
||||
- (void)moveRight:(id)sender
|
||||
{
|
||||
// Right arrow
|
||||
if (_selectedRange.location < [[self _tokens] count] && CPTokenFieldDOMInputElement.value == "")
|
||||
if ((_selectedRange.location < [[self _tokens] count] || _selectedRange.length) && CPTokenFieldDOMInputElement.value == "")
|
||||
{
|
||||
if (_selectedRange.length)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user