Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Focus webview for foregroud new frames
Browse files Browse the repository at this point in the history
Fix #1243

Auditors: @diracdeltas
  • Loading branch information
bbondy committed Apr 5, 2016
1 parent 4d53672 commit 0827c91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ class Frame extends ImmutableComponent {
activeShortcutDetails.get('action'),
true)
}
break
case 'focus-webview':
setImmediate(() => this.webview.focus())
break
}
if (activeShortcut) {
windowActions.setActiveFrameShortcut(this.props.frame, null, null)
Expand Down
11 changes: 10 additions & 1 deletion js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,16 @@ const doAction = (action) => {
windowState = windowState.merge(FrameStateUtil.addFrame(windowState.get('frames'), action.frameOpts,
nextKey, nextPartitionNumber, action.openInForeground ? nextKey : windowState.get('activeFrameKey')))
if (action.openInForeground) {
updateTabPageIndex(FrameStateUtil.getActiveFrame(windowState))
const activeFrame = FrameStateUtil.getActiveFrame(windowState)
updateTabPageIndex(activeFrame)
// For about:newtab we want to have the urlbar focused, not the new frame.
// Otherwise we want to focus the new tab when it is a new frame in the foreground.
if (activeFrame.get('location') !== 'about:newtab') {
windowState = windowState.mergeIn(activeFrameStatePath(), {
activeShortcut: 'focus-webview',
activeShortcutDetails: null
})
}
}
break
case WindowConstants.WINDOW_CLOSE_FRAME:
Expand Down

1 comment on commit 0827c91

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.