Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added scrollRectToVisible when CPTokenField becomeFirstResponder

  • Loading branch information...
commit 7bf5f6f5a9da868adb16f3e551e521233fc9b830 1 parent 182f4c3
@mrcarlberg authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 AppKit/CPTokenField.j
View
19 AppKit/CPTokenField.j
@@ -310,6 +310,8 @@ var CPScrollDestinationNone = 0,
if (CPTokenFieldInputOwner && [CPTokenFieldInputOwner window] !== [self window])
[[CPTokenFieldInputOwner window] makeFirstResponder:nil];
+ [self scrollRectToVisible:[self bounds]];
+
[self setThemeState:CPThemeStateEditing];
[self _updatePlaceholderState];
@@ -343,16 +345,19 @@ var CPScrollDestinationNone = 0,
element.style.width = CGRectGetWidth(contentRect) + "px";
element.style.height = [font defaultLineHeightForFont] + "px";
- [_tokenScrollView documentView]._DOMElement.appendChild(element);
-
window.setTimeout(function()
{
- element.focus();
- CPTokenFieldInputOwner = self;
- }, 0.0);
+ [_tokenScrollView documentView]._DOMElement.appendChild(element);
- //post CPControlTextDidBeginEditingNotification
- [self textDidBeginEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
+ //post CPControlTextDidBeginEditingNotification
+ [self textDidBeginEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
+
+ window.setTimeout(function()
+ {
+ element.focus();
+ CPTokenFieldInputOwner = self;
+ }, 0.0);
+ }, 0.0);
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
Please sign in to comment.
Something went wrong with that request. Please try again.