Closed Bug 1315509 Opened 3 years ago Closed 11 months ago

Accel+K shortcut should add ? in URL bar if search bar is removed

Categories

(Firefox :: Search, enhancement, P2)

enhancement

Tracking

()

VERIFIED FIXED
Firefox 65
Tracking Status
firefox65 --- verified

People

(Reporter: mathew.hodson, Assigned: mak)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: parity-ie, Whiteboard: [fxsearch])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0) Gecko/49.0 Firefox/49.0
Build ID: 20161025170457

Steps to reproduce:

After bug 1308931, Ctrl+K focuses the URL bar if the search bar is removed. This is better, but it still isn't as useful as the behaviour of other browsers.


Actual results:

Currently the shortcut doesn't clear the URL bar, and it doesn't prefill the special search character.


Expected results:

Ctrl+K should clear the URL bar, prefill it with ? and a space, and set the caret following the space. This should work even if the URL bar already has focus.

This would match the behaviour of Google Chrome and Microsoft Edge (which uses Ctrl+E).
Component: Untriaged → Search
Depends on: 1308931
why exactly should it prefill "?", the locationbar is perfectly able to search by itself.
The ? character makes sure that the following is interpreted as a search, and it disables auto-completion.

For example, if there was no ? character and I just typed "mozilla" into the bar and pressed enter, it wouldn't search for mozilla. It would auto-complete and navigate to http://mozilla.org/.

If I type just "localhost" and press enter, it navigates to http://localhost/. I need the ? character in order to search for localhost.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to Mathew Hodson from comment #2)
> For example, if there was no ? character and I just typed "mozilla" into the
> bar and pressed enter, it wouldn't search for mozilla. It would
> auto-complete and navigate to http://mozilla.org/.

it may autofill, and it would be enough to clear the autofilled part to search.
and with one-off buttons there'd always be a way to search.

"? work" would actually search for "? word" rather than for "word". We'd need to add special handling. At that point we should probably change the "$" restrict char for "?" and fix bug 1177895.
note currently you can accomplish the same just by typing a whitespace before the search string.
Whiteboard: [ie-parity]
(In reply to Marco Bonardo [::mak] from comment #3)
> "? work" would actually search for "? word" rather than for "word". We'd
> need to add special handling. At that point we should probably change the
> "$" restrict char for "?" and fix bug 1177895.

It doesn't happen if I just press enter. It only happens if I click on the first entry in the autocomplete drop-down or if I use the arrow keys to navigate down and then back up to the first entry and press enter.

(In reply to Marco Bonardo [::mak] from comment #4)
> note currently you can accomplish the same just by typing a whitespace
> before the search string.

This doesn't work for the localhost case.
(In reply to Mathew Hodson from comment #5)
> (In reply to Marco Bonardo [::mak] from comment #3)
> > "? work" would actually search for "? word" rather than for "word". We'd
> > need to add special handling. At that point we should probably change the
> > "$" restrict char for "?" and fix bug 1177895.
> 
> It doesn't happen if I just press enter. It only happens if I click on the
> first entry in the autocomplete drop-down or if I use the arrow keys to
> navigate down and then back up to the first entry and press enter.

that sounds broken.
did you change keyword.enabled in about:config by chance?
Could you please try in Safe mode? https://support.mozilla.org/kb/troubleshoot-firefox-issues-using-safe-mode

> (In reply to Marco Bonardo [::mak] from comment #4)
> > note currently you can accomplish the same just by typing a whitespace
> > before the search string.
> 
> This doesn't work for the localhost case.

that's expected. why do you need to search "localhost"?
(In reply to Marco Bonardo [::mak] from comment #6)
> (In reply to Mathew Hodson from comment #5)
> > (In reply to Marco Bonardo [::mak] from comment #3)
> > > "? work" would actually search for "? word" rather than for "word". We'd
> > > need to add special handling. At that point we should probably change the
> > > "$" restrict char for "?" and fix bug 1177895.
> > 
> > It doesn't happen if I just press enter. It only happens if I click on the
> > first entry in the autocomplete drop-down or if I use the arrow keys to
> > navigate down and then back up to the first entry and press enter.
> 
> that sounds broken.
> did you change keyword.enabled in about:config by chance?
> Could you please try in Safe mode?
> https://support.mozilla.org/kb/troubleshoot-firefox-issues-using-safe-mode

It behaves the same way in safe mode, and I haven't changed keyword.enabled. I think you are misunderstanding. I was describing the two circumstances that trigger the bug you mentioned where "? word" gets searched. The case where I just type "? word" then press enter doesn't trigger the bug and correctly searches for just "word".

This seems to agree with https://bugzilla.mozilla.org/show_bug.cgi?id=1177895#c2
(In reply to Mathew Hodson from comment #7)
> I think you are misunderstanding. I was describing the two circumstances
> that trigger the bug you mentioned where "? word" gets searched. The case
> where I just type "? word" then press enter doesn't trigger the bug and
> correctly searches for just "word".
> 
> This seems to agree with
> https://bugzilla.mozilla.org/show_bug.cgi?id=1177895#c2

The fact is FF 51 and 52 have a different behavior, so that comment doesn't apply anymore to these versions.
Depends on: 1177895
Priority: -- → P3
Whiteboard: [ie-parity] → [ie-parity][fxsearch]
Depends on: 1360040
I believe Chrome just adds a single question mark with no space to force search when you press Ctrl+K, e.g. "?node.js", "?localhost", "?1.2.3.4", "?[::]", "?http://search.for.referring.sites.or.cached.copy/url"

...it's Edge that has started to add a space after the question mark when you press Ctrl+E to force a search (but both work with and without the space).  Chrome now has a (probably) better UI which shows "Search Google" when the first character in the bar is a question mark (or if you press Ctrl+K).

I think it would be better for Ctrl+K to behave more like Chrome (just the question mark without a space) as it's then just a backspace to remove to enter a URL with normal completion (to convert Ctrl+K to a normal Awesomebar entry), and equally manually type a single question mark to force a search if you're just in the location bar (convert a Ctrl+L or Alt+D to a forced search just by hitting '?').  


So the behaviour for parity with other browsers would be summarised as:  

* When there is no search bar in the toolbar or menu, Ctrl+K will focus the Awesomebar and enter a single question mark. 

* The Awesomebar completion should be aware that entries with an initial '?' (any whitespace trimmed) are a forced search (don't show URL completion or open tab, but only search suggestions/history).

* Enter/go will perform a default engine search and never interpret the typed content as a domain name.  Any search (default engine or a click of a one-off search engine) will ignore any initial question mark (and leading whitespace after it).


Also related, not removing the leading question mark for the search (this is the case when there isn't a space): Bug #1334019 -- personally, I run in to this problem all the time when using the Awesomebar for searching for programming terms with dots in (but no spaces), and I'm pretty sure manually adding the '?' used to work in Firefox, but perhaps it was Google trimming it out of the query.


I'm not really sure about the interactions with the "restriction tokens" -- it would be simpler to make the initial question mark treat everything else as a search term, not only fixing searches for things which would be interpreted as a domain but, as a side-effect, it would also allow querying any string which would otherwise be treated as a "restriction token" (improving the awesomebar susggestions).
Blocks: 1386548
Duplicate of this bug: 1404613
Mass bug change to replace various 'parity' whiteboard flags with the new canonical keywords. (See bug 1443764 comment 13.)
Keywords: parity-ie
Whiteboard: [ie-parity][fxsearch] → [fxsearch]
This should be trivial, and now that the search restriction token is "?" it makes lots of sense.
Assignee: nobody → mak77
Status: NEW → ASSIGNED
Priority: P3 → P2
Depends on: 1499743
The patch also fixes bug 1177895, because otherwise it wouldn't make much sense.
Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/9ef539ed2f40
Ctrl+K shortcut should add '?' to the Address Bar if search bar is removed. r=adw
https://hg.mozilla.org/mozilla-central/rev/9ef539ed2f40
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Depends on: 1514282
Depends on: 1515323
Depends on: 1334019
No longer depends on: 1177895
I can see this implemented with latest 65.0b6 in Linux x86_64

Build ID 	20181220174318
User Agent 	Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
QA Whiteboard: [testday-20181221]
This bug was about implementing "Ctrl+K shortcut should add ? in URL bar if search bar is removed" and I have seen the feature being implemented with latest Beta on Windows 7, 64 Bit!

Build ID 	20181220174318
User Agent 	Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0

[testday-20181221]
As per comment 17 and comment 18, this is now verified as fixed in both Linux and windows. Marking this bug accordingly.
Status: RESOLVED → VERIFIED
Depends on: 1516130
Summary: Ctrl+K shortcut should add ? in URL bar if search bar is removed → Accel+K shortcut should add ? in URL bar if search bar is removed
Depends on: 1524016
Depends on: 1524402

Ctrl+L provides the previous behaviour (and presumably there is no intention to change that).

Just making this workaround clear to anyone else who, like me, reported this new behaviour as a regression.

Type: defect → enhancement
No longer depends on: 1524402
You need to log in before you can comment on or make changes to this bug.