Skip to content

Commit

Permalink
Refs #1364. Avoid repeated makeFirstResponder: calls within sheet par…
Browse files Browse the repository at this point in the history
…ent.

If a window contained a text field which was the initial first responder, and the window was displaying a sheet, clicking on the window would cause the text field to alternate between being the first responder and not.

This was caused by the window `orderFront:` setting its first responder to the initial responder if there wasn't any responder yet. This would cause the text field to focus, even that the window wasn't the key window, and then on the next click the text field would blur which would make the text field automatically resign its first responder status.

The solution is to leave the first responder status alone if a window which isn't the key window is `orderFront:`ed. This appears to be more sensible UX in general. You don't expect the first responder of non-key windows to change when you click it's background.
  • Loading branch information
aljungberg committed Aug 14, 2012
1 parent 77266e0 commit e3d0d69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions AppKit/CPWindow/CPWindow.j
Expand Up @@ -857,12 +857,12 @@ CPTexturedBackgroundWindowMask
[_platformWindow order:CPWindowAbove window:self relativeTo:nil];
#endif

if (_firstResponder === self || !_firstResponder)
[self makeFirstResponder:_initialFirstResponder];

if (!CPApp._keyWindow)
[self makeKeyWindow];

if ([self isKeyWindow] && (_firstResponder === self || !_firstResponder))
[self makeFirstResponder:_initialFirstResponder];

if (!CPApp._mainWindow)
[self makeMainWindow];
}
Expand Down

0 comments on commit e3d0d69

Please sign in to comment.