From 1663edc62d84a0b6fd9610c0e167961b98084773 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 12 May 2015 13:45:45 +0100 Subject: Fix bad UX for with prompted text. The existing behaviour is poor UX. Also, add binding. This is a poor choice. We'll need to think about this. --- pages/vomnibar.coffee | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'pages') diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee index 6485aed8..2aa70379 100644 --- a/pages/vomnibar.coffee +++ b/pages/vomnibar.coffee @@ -191,19 +191,20 @@ class VomnibarUI @updateSelection() else if (action == "enter") if @selection == -1 + # / includes prompted text in the query (normally it is not included). + # + # FIXME(smblott). This is a terrible binding. would be better, but that's already being + # used. We need a better UX around how to include the prompted text in the query. then + # works, but that's ugly too. + window.getSelection().collapseToEnd() if event.altKey or event.metaKey # The user has not selected a suggestion. - query = @input.value.trim() + query = @getInputWithoutPromptedText().trim() # on an empty vomnibar is a no-op. return unless 0 < query.length if @suppressedLeadingKeyword? - # This is a custom search engine completion. Because of the way we add prompted text to the input - # (addPromptedText), the text in the input might not correspond to any of the completions. So we - # fire off the query to the background page and use the completion at the top of the list (which - # will be the right one). - # - # on its own selects only the text that the user has typed. also includes - # any prompted text. - window.getSelection()?.collapseToEnd() if @inputContainsASelectionRange() and event.ctrlKey + # This is a custom search engine completion. The text in the input might not correspond to any of + # the completions. So we fire off the query to the background page and use the completion at the + # top of the list (which will be the right one). @update true, => if @completions[0] completion = @completions[0] -- cgit v1.2.3