diff --git a/docs/windowActions.md b/docs/windowActions.md index bd99a721800..3d1089135fd 100644 --- a/docs/windowActions.md +++ b/docs/windowActions.md @@ -215,13 +215,14 @@ Dispatches a message to the store to create a new frame **Parameters** **frameOpts**: `Object`, An object of frame options such as isPrivate, element, and tab features. - These may not all be hooked up in Electron yet. +These may not all be hooked up in Electron yet. -**openInForeground**: `boolean`, true if the new frame should become the new active frame +**openInForeground**: `boolean`, true if the new frame should become the new active frame. +If missing, this value will be defaulted to the user's preference (SWITCH_TO_NEW_TABS). -### cloneFrame(frameProps, guestInstanceId) +### cloneFrame(frameProps, guestInstanceId, openInForeground) Dispatches a message to the store to clone an existing frame @@ -231,6 +232,9 @@ Dispatches a message to the store to clone an existing frame **guestInstanceId**: `number`, The guestInstanceId of the cloned webcontents +**openInForeground**: `boolean`, true if the new frame should become the new active frame. +If missing, this value will be defaulted to the user's preference (SWITCH_TO_NEW_TABS). + ### closeFrame(frames, frameProps) diff --git a/js/actions/windowActions.js b/js/actions/windowActions.js index 06a810574ec..594d4f10e5d 100644 --- a/js/actions/windowActions.js +++ b/js/actions/windowActions.js @@ -281,8 +281,9 @@ const windowActions = { * Dispatches a message to the store to create a new frame * * @param {Object} frameOpts - An object of frame options such as isPrivate, element, and tab features. - * These may not all be hooked up in Electron yet. - * @param {boolean} openInForeground - true if the new frame should become the new active frame + * These may not all be hooked up in Electron yet. + * @param {boolean} openInForeground - true if the new frame should become the new active frame. + * If missing, this value will be defaulted to the user's preference (SWITCH_TO_NEW_TABS). */ newFrame: function (frameOpts, openInForeground) { dispatch({ @@ -297,6 +298,8 @@ const windowActions = { * * @param {Object} frameProps - The properties of the frame to clone * @param {number} guestInstanceId - The guestInstanceId of the cloned webcontents + * @param {boolean} openInForeground - true if the new frame should become the new active frame. + * If missing, this value will be defaulted to the user's preference (SWITCH_TO_NEW_TABS). */ cloneFrame: function (frameProps, guestInstanceId, openInForeground) { dispatch({ diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index 2064bf08236..795356fcb54 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -168,8 +168,8 @@ const newFrame = (frameOpts, openInForeground, insertionIndex, nextKey) => { } frameOpts = frameOpts.toJS ? frameOpts.toJS() : frameOpts - if (openInForeground === undefined) { - openInForeground = true + if (typeof openInForeground !== 'boolean') { + openInForeground = getSetting(settings.SWITCH_TO_NEW_TABS) } // evaluate the location