Bug 1224605

Summary: [GTK3] Ctrl-K does not work from GtkEntry
Product: [Fedora] Fedora Reporter: Michele Baldessari <michele>
Component: firefoxAssignee: Martin Stransky <stransky>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 22CC: abbublu, adam.a.johnson, AprilVRose, bastiaan, ccecchi, fdc, fweimer, gecko-bugs-nobody, gordon.messmer, guerda, jhorak, kparal, mclasen, michele, michele, m, nobody, poelstra, scott, stransky, yajo.sk8
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-13 13:34:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michele Baldessari 2015-05-25 06:19:13 UTC
Description of problem:
I just upgraded to F22 and noticed the following:
- When firefox is started (i.e. the start.fedoraproject.org page or the "sorry the last session crashed"), the Ctrl-K binding to go to the search area has no effect
- Also when opening a fresh new tab Ctrl-K does not work
- Interestingly when any URL is typed in the URL bar and the page is loaded, then Ctrl-K works correctly on that tab

It is as if Ctrl-K works only after a proper page is loaded

Version-Release number of selected component (if applicable):
firefox-38.0.1-1.fc22.x86_64

How reproducible:
100%


Additional info:
I am using gnome-shell from a completely clean user /home and Ctrl-K is not mapped
anywhere (I can use ctrl-K in other application without issues)

Comment 1 Martin Stransky 2015-05-25 08:44:58 UTC
I guess the CTRL+K does not work when cursor is in any entry/input box. Is that correct? 

As for the new tab - when it's opened I have the cursor in URL bar and CTRL+K has no effect then. If I just press TAB to get out of the URL bar (web page gets focus) the CTRL+K works again.

Comment 2 Martin Stransky 2015-05-25 08:46:26 UTC
The same happens here in bugzilla - when cursor is in bug number field, CTRL+K does not work.

Comment 3 Michele Baldessari 2015-05-25 14:42:06 UTC
You're correct Martin, I had not noticed that it is always related to the focus
being in an entry input/box. Once the focus is out of an input box, Ctrl-K works
again

Comment 4 April 2015-05-31 11:35:28 UTC
Clarification: works from HTML textareas but not from HTML inputs.

Ctrl-L works. Did some experimenting using the Menu Wizard extension to switch the keybindings for Ctrl-L and Ctrl-K ... the results indicate that the problem is specific to the Ctrl-K key combination as opposed to specific to focusing the search box.

Comment 5 Adam Johnson 2015-06-10 10:45:28 UTC
Looks like Ctrl-K performes the ancient input function of Killing the remainder of the input line to the right of the cursor.  I think I can count on 2 hands the number of times over the last few decades I've intentionally used Ctrl-K for killing the rest of the line, I can't count how many times I used Ctrl-K to navigate to Firefox's search box in the last week, so my vote is to revert the Firefox URL input bar to un-map or override the input rule of Ctrl-K to retain the previous behavior of navigation to the search box.

I suppose I could get used to a new keyboard shortcut for navigation to the search box, but if that's the case, I certainly hope it's the same across platforms - the Ctrl-# (Windows) vs Alt-# (Fedora) for switching tabs is already enough of a headache.

Comment 6 Martin Stransky 2015-06-10 18:45:10 UTC
Yes, we need to disable the CTRL+K nonsense. Guys, how we can disable it for all Firefox GtkEntry elements? Thanks!

Comment 7 Jan Horak 2015-06-11 14:37:50 UTC
Introduced by this change:
https://git.gnome.org/browse/gtk+/commit/?id=423868b408e0997af9e9af6a3ae5bb1ff50a0965

Comment 8 Matthias Clasen 2015-06-13 00:19:17 UTC
(In reply to Martin Stransky from comment #6)
> Yes, we need to disable the CTRL+K nonsense. Guys, how we can disable it for
> all Firefox GtkEntry elements? Thanks!

One persons nonsense is another persons feature request...

Here is a css snipplet that disables the key binding:

@binding-set firefox
{
  unbind "<ctrl>k";
}

GtkEntry {
  gtk-key-bindings: firefox;
}

Comment 9 Matthias Clasen 2015-06-13 00:44:18 UTC
*** Bug 1215294 has been marked as a duplicate of this bug. ***

Comment 10 Martin Stransky 2015-06-15 06:55:34 UTC
(In reply to Matthias Clasen from comment #8)
> (In reply to Martin Stransky from comment #6)
> > Yes, we need to disable the CTRL+K nonsense. Guys, how we can disable it for
> > all Firefox GtkEntry elements? Thanks!
> 
> One persons nonsense is another persons feature request...

Sorry, I don't mean to offend anyone.

> Here is a css snipplet that disables the key binding:
> 
> @binding-set firefox
> {
>   unbind "<ctrl>k";
> }
> 
> GtkEntry {
>   gtk-key-bindings: firefox;
> }

How we can pass that to the GtkEntry elements?

Comment 11 Jesse Kennedy 2015-06-15 15:19:16 UTC
(In reply to Matthias Clasen from comment #8)
> (In reply to Martin Stransky from comment #6)
> > Yes, we need to disable the CTRL+K nonsense. Guys, how we can disable it for
> > all Firefox GtkEntry elements? Thanks!
> 
> One persons nonsense is another persons feature request...
> 
> Here is a css snipplet that disables the key binding:
> 
> @binding-set firefox
> {
>   unbind "<ctrl>k";
> }
> 
> GtkEntry {
>   gtk-key-bindings: firefox;
> }

How can I apply this CSS as a workaround?

Comment 12 Matthias Clasen 2015-06-15 18:20:22 UTC
You should be able to put this snipplet in $HOME/.config/gtk-3.0/gtk.css, but then it will apply to all entries in all applications.

Comment 13 Michele Baldessari 2015-06-15 19:54:37 UTC
Thanks a lot Matthias, workaround works fine ;)

What other options do the firefox maintainers have to ship this workaround
for every user (short of creating a css in each users homedir, which would
be undesirable for a number of reasons)? Subclass GtkEntry and call somewheregtk_binding_entry_remove(), a specially placed .css file that only 
applies to firefox?

Comment 14 Martin Stransky 2015-06-16 08:32:32 UTC
Yes, we need to disable it in Firefox only but for all users - to restore the CTRL+K functionality. Is there any way?

Comment 15 John Poelstra 2015-06-22 14:51:46 UTC
This is driving me crazy since moving to Fedora 22.

Can someone provide the specific steps to re-enable ctrl-k to work properly in Firefox? It's worked this way for years (and still does on other platforms). 

Apologies if I'm piling onto the wrong bug.. this was the only one I could find.

Comment 16 Michele Baldessari 2015-06-22 14:56:20 UTC
John,

this is the current workaround:
more ~/.config/gtk-3.0/gtk.css 
@binding-set firefox
{
          unbind "<ctrl>k";
}

GtkEntry {
          gtk-key-bindings: firefox;
}

Comment 17 John Poelstra 2015-06-22 15:09:14 UTC
(In reply to Michele Baldessari from comment #16)
> John,
> 
> this is the current workaround:
> more ~/.config/gtk-3.0/gtk.css 
> @binding-set firefox
> {
>           unbind "<ctrl>k";
> }
> 
> GtkEntry {
>           gtk-key-bindings: firefox;
> }

THANK YOU!

Comment 18 Kamil Páral 2015-06-22 15:16:51 UTC
(In reply to John Poelstra from comment #15)
> This is driving me crazy since moving to Fedora 22.

As another workaround, Ctrl+J works as well, and it's not that far away from Ctrl+K :-)

https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly#w_search

Comment 19 Martin Stransky 2015-06-23 07:45:16 UTC
*** Bug 1234743 has been marked as a duplicate of this bug. ***

Comment 20 Martin Stransky 2015-06-23 20:28:30 UTC
Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1176929

Comment 21 Gordon Messmer 2015-06-25 22:40:53 UTC
(In reply to Kamil Páral from comment #18)
> 
> As another workaround, Ctrl+J works as well, and it's not that far away from
> Ctrl+K :-)

True, but Ctrl+J shows downloads in Thunderbird and Chrome, while Ctrl+K moves the cursor to a search box.  As a workaround, Ctrl+J is inconsistent with similar applications, and tends to be confusing.

Comment 22 Thomas Perl 2015-08-27 08:53:51 UTC
Related Gtk+3 upstream bug report:
https://bugzilla.gnome.org/show_bug.cgi?id=749944

This is a regression introduced last September in Gtk+3, see here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1176929#c40

The workaround in comment 16 didn't work for me, possibly because the keybindings are hardcoded and not defined in a .css file?

Comment 23 Martin Stransky 2015-09-11 07:41:38 UTC
BTW. This bug is blocking official Mozilla switch to Gtk3 now:

https://bugzilla.mozilla.org/show_bug.cgi?id=1176929 (and many other dupes)

We make sure Gtk3 migration is as hard as possible. Good work guys!

Comment 24 Matthias Clasen 2015-10-05 19:28:53 UTC
This was fixed for 3.18.0 in f23. Time to retire this bug before it accumulates more acerbic comments.