From fd3ad76db30f6f9cb44d6b3a5e81a83f6cfc47ae Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sun, 18 Nov 2012 22:32:41 +0000 Subject: [PATCH] Fixed: after tabbing to a token field it'd immediately lose first responder status. Without this fix, the tab key press would be propagated to the browser, which would blur the focused input element, even when that input element was the one the new first responder intended to use. --- AppKit/CPWindow/CPWindow.j | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 9fa4ffd69..01bf60f10 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -1673,11 +1673,29 @@ CPTexturedBackgroundWindowMask [self selectPreviousKeyView:self]; else [self selectNextKeyView:self]; - +#if PLATFORM(DOM) + // Make sure the browser doesn't try to do its own tab handling. + // This is important or the browser might blur the shared text field or token field input field, + // even that we just moved it to a new first responder. + [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO] +#endif return; } else if ([anEvent charactersIgnoringModifiers] === CPBackTabCharacter) - return [self selectPreviousKeyView:self]; + { + var didTabBack = [self selectPreviousKeyView:self]; + if (didTabBack) + { +#if PLATFORM(DOM) + // Make sure the browser doesn't try to do its own tab handling. + // This is important or the browser might blur the shared text field or token field input field, + // even that we just moved it to a new first responder. + [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO] +#endif + } + + return didTabBack; + } [[self firstResponder] keyDown:anEvent];