New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 1433475 — Keyboard — enable up and down arrows in location bar. #3706
The head ref may contain hidden characters: "jhugman/Bug1433475\u2014keyboard\u2014up-and-down-in-urlbar"
Bug 1433475 — Keyboard — enable up and down arrows in location bar. #3706
Conversation
SwiftLint found issuesWarnings
Generated by 🚫 Danger |
@@ -1753,6 +1753,7 @@ extension BrowserViewController: SearchViewControllerDelegate { | |||
} | |||
|
|||
func searchViewControllerDidFinishHighlighting(_ searchViewController: SearchViewController) { | |||
searchViewController.resignFirstResponder() | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is called when the user has typed DOWN, then UP — i.e. focus should move back to the location bar.
} | ||
|
||
func handleKeyCommands(sender: UIKeyCommand) { | ||
let initialSection = SearchListSection.bookmarksAndHistory.rawValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might change this value when we get we get to Bug 1433476.
return | ||
} | ||
|
||
tableView(tableView, didSelectRowAtIndexPath: current) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this delegate here feels weird. How do we perform the same action a tap performs?
} | ||
} | ||
let next = IndexPath(item: nextItem, section: nextSection) | ||
self.tableView(tableView, didHighlightRowAt: next) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this delegate here feels weird. tableView.selectRow
does the highlighting.
} | ||
|
||
func searchViewControllerDidFinishHighlighting(_ searchViewController: SearchViewController) { | ||
searchViewController.resignFirstResponder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is called when the user has typed DOWN, then UP — i.e. focus should move back to the location bar.
Also tried: explicitly setting BVC or the location bar as first responder.
I think to simplify this. It might be easier to never change the focus from the AutocompleteTextField. Instead just pass the up/down keypress from the textfield down to the SearchViewController. That way you dont have to worry about show/hiding the keyboard. Where this gets tricky is handling the search suggestions. Because they are shown horizontally, tapping left/right to switch between them wouldnt work because on the textfield that would move your cursor. I think this is why safari/chrome/firefox desktop show autocomplete suggestions as a list instead of the way we do. |
Yeah, I think you've answered your own question about why we can't do this.
Ug. I wasn't considering the soft keyboard for |
55112c0
to
2271022
Compare
Ok, I think I've cracked it. Looking at desktop, they seem to be leaving the cursor with the text view, and you can move it around with the cursor. I'm not altogether happy with what we've got here — but we're limited by the design of the search auto-complete. I'm leaving the horizontal keys for the next follow up bug. |
I'm getting a pretty bad crash that happens when there are no urls in the searchsuggestions tableview.
I think in the optimal case I dont think we should move focus away from the keyboard. I think this should work exactly like Desktop. For example. if you want to go to right now. if you want to continue typing for any reason you have to arrow up all the way to the urlbar. |
This doesn't do things in the right way however: the search controller should be providing the shortcuts, not the BVC.
Hightlighted URL is shown in URL bar.
Previously the autocomplete delegate's `didEnterText` was being called explicitly was being called both explicitly and implicitly (from `textDidChange`). This allows us to set the location updating the search suggestions or history/bookmarks.
2271022
to
d56f583
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that one unused var. looks awesome! Can't wait for this to land.
@@ -69,6 +71,10 @@ class SearchViewController: SiteTableViewController, KeyboardHelperDelegate, Loa | |||
|
|||
static var userAgent: String? | |||
|
|||
var isCellHighlighted: Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is used anywhere.
…3706) r=farhan This bug allows the user to select URL completions (from bookmarks and history) to be selected via the keyboard. Desktop leaves the cursor in the location field, which means than horizontal cursor movement is possible. We try to replicate that. There do seem to be some difficulty supporting search suggestions, so this is rolled into another bug.
This PR allows the user to select URL completions (from bookmarks and history) to be selected via the keyboard.
Desktop leaves the cursor in the location field, which means than horizontal cursor movement is possible.
We aren't able to do this, given that the search suggestions for the query appear horizontally.
Please file follow up usability bugs.
r? for @farhan.
https://bugzilla.mozilla.org/show_bug.cgi?id=1433475