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

Address bar should be active for about:newtab #3933

Merged
merged 1 commit into from
Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/windowActions.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,16 @@ are no autocomplete results.



### setUrlBarFocused(isFocused)

Marks the URL bar as focused or not.

**Parameters**

**isFocused**: `boolean`, Whether or not the URL bar should be marked as focused



### setActiveFrameShortcut(frameProps, activeShortcut, activeShortcutDetails)

Dispatches a message to the store to indicate that the pending frame shortcut info should be updated.
Expand Down
11 changes: 11 additions & 0 deletions js/actions/windowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,17 @@ const windowActions = {
})
},

/**
* Marks the URL bar as focused or not.
*
* @param {boolean} isFocused - Whether or not the URL bar should be marked as focused
*/
setUrlBarFocused: function (isFocused) {
dispatch({
actionType: WindowConstants.WINDOW_SET_URL_BAR_FOCUSED,
isFocused
})
},
/**
* Dispatches a message to the store to indicate that the pending frame shortcut info should be updated.
*
Expand Down
2 changes: 1 addition & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class Frame extends ImmutableComponent {
// to the UrlBar
if (this.props.location === 'about:newtab') {
windowActions.setUrlBarActive(true)
windowActions.setUrlBarSelected(false)
windowActions.setUrlBarFocused(true)
} else {
// If it is a regular webpage, just focus the webcontents
this.webview.focus()
Expand Down
9 changes: 8 additions & 1 deletion js/components/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ class Tab extends ImmutableComponent {
dnd.onDragOver(dragTypes.TAB, this.tabNode.getBoundingClientRect(), this.props.tab.get('frameKey'), this.draggingOverData, e)
}

setActiveFrame () {
setActiveFrame (event) {
event.stopPropagation()
windowActions.setActiveFrame(this.frame)

if (this.frame.get('location') === 'about:newtab') {
windowActions.setUrlBarActive(true)
windowActions.setUrlBarFocused(true)
windowActions.setUrlBarSelected(false)
}
}

onCloseFrame (event) {
Expand Down
1 change: 1 addition & 0 deletions js/constants/windowConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const windowConstants = {
WINDOW_CLEAR_CLOSED_FRAMES: _,
WINDOW_SET_ACTIVE_FRAME_SHORTCUT: _,
WINDOW_SET_URL_BAR_SELECTED: _,
WINDOW_SET_URL_BAR_FOCUSED: _,
WINDOW_SET_SEARCH_DETAIL: _,
WINDOW_SET_FIND_DETAIL: _,
WINDOW_SET_BOOKMARK_DETAIL: _, // If set, also indicates that add/edit is shown
Expand Down
3 changes: 3 additions & 0 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ const doAction = (action) => {
case WindowConstants.WINDOW_SET_URL_BAR_AUTCOMPLETE_ENABLED:
windowState = windowState.setIn(activeFrameStatePath().concat(['navbar', 'urlbar', 'suggestions', 'autocompleteEnabled']), action.enabled)
break
case WindowConstants.WINDOW_SET_URL_BAR_FOCUSED:
windowState = windowState.setIn(activeFrameStatePath().concat(['navbar', 'urlbar', 'focused']), action.isFocused)
break
case WindowConstants.WINDOW_SET_URL_BAR_SELECTED:
const urlBarPath = activeFrameStatePath().concat(['navbar', 'urlbar'])
windowState = windowState.mergeIn(urlBarPath, {
Expand Down