搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Right click menu keyboard shortcut

more options

Hello,

I upgraded my FireFox to the latest version 88.0 today, and noticed some changes on right click menu. In the old version, the keyboard shortcut key is a to copy a link, but now it was changed to L. That is really inconvenient. As you know, when you right click a link using the mouse, your right hand is still holding the mouse, and not easy to press the letter L on the keyboard.

The old menu option is "Copy Link Locaton", but the new one is "Copy Link".

Is it possible to customize the keyboard shortcut of right click menu, please?

Thank you! Brian

Hello, I upgraded my FireFox to the latest version 88.0 today, and noticed some changes on right click menu. In the old version, the keyboard shortcut key is a to copy a link, but now it was changed to L. That is really inconvenient. As you know, when you right click a link using the mouse, your right hand is still holding the mouse, and not easy to press the letter L on the keyboard. The old menu option is "Copy Link Locaton", but the new one is "Copy Link". Is it possible to customize the keyboard shortcut of right click menu, please? Thank you! Brian

被選擇的解決方法

Can you post a screenshot that shows the content of both files ?

Note that the autoconfig.js file must use Unix end-of-line (LF), even on Windows systems with Firefox 60 or higher.

You can possibly paste this data URI in the location bar and save the file as autoconfig.js

data:application/octet-stream;base64,Ly8KcHJlZigiZ2VuZXJhbC5jb25maWcuZmlsZW5hbWUiLCAiYXV0b2NvbmZpZy5jZmciKTsKcHJlZigiZ2VuZXJhbC5jb25maWcub2JzY3VyZV92YWx1ZSIsIDApOwpwcmVmKCJnZW5lcmFsLmNvbmZpZy5zYW5kYm94X2VuYWJsZWQiLCBmYWxzZSk7
從原來的回覆中察看解決方案 👍 1

所有回覆 (18)

more options

its the same thing right, convenience is a just a opinion

more options

Hi Brian, this issue has been raised with the developers and is under discussion, but it's too soon to tell whether a will be restored as the accelerator key for this item.

Meanwhile, someone has created an add-on to restore use of A (using a new items toward the bottom of the menu). It has low adoption so far, but doesn't require scary permissions, so if it's critical for you, you may want to try it:

https://addons.mozilla.org/firefox/addon/copy-link-address-a/

more options

Hello Jscher,

Thanks for your quick reply! I really appreciate that!

I can't believe someone so quickly has developed such a small plug-in. It is awesome!

But is it possible to make the customization manually rather than adding the plugin?

Thank you again! Brian

more options

This post expressed my question clearly.

https://bugzilla.mozilla.org/show_bug.cgi?id=423905 by Robert Wolf, and here is a copy


As Juraj Masiar writes: I know people using the keys in the context menu are minority, but those keys are there only for this minority group. So if you change it, it will affect 100% of those users (probably power-users / programmers, just like you are

   People using access keys for context menus are a very small minority and it'll look very strange to everyone else

Would not then be better to disable these access keys completely? Normal user does not use them and if we, power users, use them, then we need them to be stable and consistent. I could accept at least some key from left side of keyboard, but the L on the most right side of keyboard is nonsense for me as for others. If I click with right hand on mouse for context menu, then I need to use left hand to press access key. In fact I was very happy, that Firefox has this access key "A", because I use it really oft and Chrome does not have this shortcut so I am stressed everytime I have to use chrome and I want to copy some link. I hope this access key will be changed back to "A", until then I have to use the extenstion "Copy Link Address".

It's small stupid change for you, but it's big disaster for us power-users :-)

more options

Brian_30@IRQ said

But is it possible to make the customization manually rather than adding the plugin?

Hi Brian, I don't know of a way to "hack" the menu, unfortunately.

more options

Hi Brian, I'm back from the rabbit hole. There is a way to run code in Firefox's Browser Console (Ctrl+Shift+j) or in a startup script to make internal changes to the browser. The code is slightly different and I tested and posted a script for the browser console:

https://gist.github.com/jscher2000/1037c1e95015470289eb4241c3731fc5

This is what you get on the menu after running the script:

I should create a demo video but I'm a little zonked at the moment. Maybe tomorrow.

more options

jscher2000 said

Hi Brian, I'm back from the rabbit hole. There is a way to run code in Firefox's Browser Console (Ctrl+Shift+j) or in a startup script to make internal changes to the browser. The code is slightly different and I tested and posted a script for the browser console: https://gist.github.com/jscher2000/1037c1e95015470289eb4241c3731fc5 This is what you get on the menu after running the script: I should create a demo video but I'm a little zonked at the moment. Maybe tomorrow.

Hi Jscher,

I really appreciate your help here!

This script works! It is awesome! Your comments are clear and easy to install the code.

Hope each one who wants this feather can see this post!

Thanks a million! Brian

more options

jscher2000 said

Hi Brian, I'm back from the rabbit hole. There is a way to run code in Firefox's Browser Console (Ctrl+Shift+j) or in a startup script to make internal changes to the browser. The code is slightly different and I tested and posted a script for the browser console: https://gist.github.com/jscher2000/1037c1e95015470289eb4241c3731fc5 This is what you get on the menu after running the script: I should create a demo video but I'm a little zonked at the moment. Maybe tomorrow.

Hi Jscher,

Could you please update the script and change key A to "Copy Email Link" menu too?

Thanks! Brian

more options

There is a way to do this automatically via the autoconfig.cfg file like in the referenced subreddit thread.

See my reply for another example in this thread for more detail:

See also:


"C:\Program Files\Mozilla Firefox\autoconfig.cfg":

// autoconfig.cfg must start with a comment line
 try {
  let {classes:Cc, interfaces:Ci, manager:Cm, utils:Cu} = Components;
  let Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
  function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
  ConfigJS.prototype = {
   observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
   handleEvent: function (aEvent) {
    let document = aEvent.originalTarget;
    let window = document.defaultView;
    let location = window.location;
    if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
      if (window._gBrowser) {
       let myKeyChanges = [{id:'context-copylink',newlbl:'Copy Link Location',newkey:'a'},{id:'context-copyemail',newkey:'A',newlbl:'Copy Email Address'}];
       var i,mK,menuitem;
       for (i=0; mK=myKeyChanges[i]; i++){
        menuitem = window.document.getElementById(mK.id);
        if (menuitem) {
         if (mK.newlbl) menuitem.setAttribute('label'    , mK.newlbl);
         if (mK.newkey) menuitem.setAttribute('accesskey', mK.newkey);
        }
       }
      }
    }
   }
  };
  if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
 } catch(ex) {};


"C:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js":

// first line is a comment line
pref("general.config.filename", "config.js");    
pref("general.config.obscure_value", 0);  
pref("general.config.sandbox_enabled", false);

由 cor-el 於 修改

more options

Brian_30@IRQ said

Could you please update the script and change key A to "Copy Email Link" menu too?

Yes, I added that. I also added a bit to change "Copy Link" back to "Copy Link Location" (and set the key to lower case a) as I find myself looking for that wording.

https://gist.github.com/jscher2000/1037c1e95015470289eb4241c3731fc5

more options

Note that "accesskey = w" is reserved for main-context-menu-open-link-container-tab => #context-openlinkinusercontext-menu (bug 1690561,1690561)

由 cor-el 於 修改

more options

jscher2000 said

Brian_30@IRQ said

Could you please update the script and change key A to "Copy Email Link" menu too?

Yes, I added that. I also added a bit to change "Copy Link" back to "Copy Link Location" (and set the key to lower case a) as I find myself looking for that wording.

https://gist.github.com/jscher2000/1037c1e95015470289eb4241c3731fc5

Hi Jscher,

Thanks for your update! It works on my firefox 88 on Windows 7. Both capital and small A letters works here.

But could you please combine core-el's option? I ask because every time I restart firefox, I have to manually run the script. It is a bit inconvenient, especially for common users without any coding experience.

Thanks again! Brian

more options

cor-el said

There is a way to do this automatically via the autoconfig.cfg file like in the referenced subreddit thread. See my reply for another example in this thread for more detail: See also:

"C:\Program Files\Mozilla Firefox\autoconfig.cfg":

// autoconfig.cfg must start with a comment line
 try {
  let {classes:Cc, interfaces:Ci, manager:Cm, utils:Cu} = Components;
  let Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
  function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
  ConfigJS.prototype = {
   observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
   handleEvent: function (aEvent) {
    let document = aEvent.originalTarget;
    let window = document.defaultView;
    let location = window.location;
    if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
      if (window._gBrowser) {
       let myKeyChanges = [{id:'context-copylink',newlbl:'Copy Link Location',newkey:'a'},{id:'context-copyemail',newkey:'A',newlbl:'Copy Email Address'}];
       var i,mK,menuitem;
       for (i=0; mK=myKeyChanges[i]; i++){
        menuitem = window.document.getElementById(mK.id);
        if (menuitem) {
         if (mK.newlbl) menuitem.setAttribute('label'    , mK.newlbl);
         if (mK.newkey) menuitem.setAttribute('accesskey', mK.newkey);
        }
       }
      }
    }
   }
  };
  if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
 } catch(ex) {};


"C:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js":

// first line is a comment line
pref("general.config.filename", "config.js");    
pref("general.config.obscure_value", 0);  
pref("general.config.sandbox_enabled", false);

Hello,

Thank you for your information! I really appreciate that!

I understand this autoconfig script should be loaded on firefox starting. But I got an alert here. Could you please check it? I attached a screenshot below.

Thanks! Brian

由 cor-el 於 修改

more options

It would be great if you could append a quick post on this post too. I saw a lot of users have the same trouble, but can do nothing about it. I tried to login, but I have problem to login bugzilla.mozilla.org with my firefox account. https://bugzilla.mozilla.org/show_bug.cgi?id=423905

Thanks! Brian

more options

選擇的解決方法

Can you post a screenshot that shows the content of both files ?

Note that the autoconfig.js file must use Unix end-of-line (LF), even on Windows systems with Firefox 60 or higher.

You can possibly paste this data URI in the location bar and save the file as autoconfig.js

data:application/octet-stream;base64,Ly8KcHJlZigiZ2VuZXJhbC5jb25maWcuZmlsZW5hbWUiLCAiYXV0b2NvbmZpZy5jZmciKTsKcHJlZigiZ2VuZXJhbC5jb25maWcub2JzY3VyZV92YWx1ZSIsIDApOwpwcmVmKCJnZW5lcmFsLmNvbmZpZy5zYW5kYm94X2VuYWJsZWQiLCBmYWxzZSk7
more options

Note that Bugzilla isn't meant not be used that way (it is not a forum, but meant for devs to communicate).

more options

cor-el said

Can you post a screenshot that shows the content of both files ? Note that the autoconfig.js file must use Unix end-of-line (LF), even on Windows systems with Firefox 60 or higher. You can possibly paste this data URI in the location bar and save the file as autoconfig.js
data:application/octet-stream;base64,Ly8KcHJlZigiZ2VuZXJhbC5jb25maWcuZmlsZW5hbWUiLCAiYXV0b2NvbmZpZy5jZmciKTsKcHJlZigiZ2VuZXJhbC5jb25maWcub2JzY3VyZV92YWx1ZSIsIDApOwpwcmVmKCJnZW5lcmFsLmNvbmZpZy5zYW5kYm94X2VuYWJsZWQiLCBmYWxzZSk7

"C:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js":

// first line is a comment line pref("general.config.filename", "config.js"); // I changed config.js to autoconfig.cfg, and everything works fine! pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);

more options

Brian_30@IRQ said

"C:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js":
// first line is a comment line
pref("general.config.filename", "config.js");    
// I changed config.js to autoconfig.cfg, and everything works fine!
pref("general.config.obscure_value", 0);  
pref("general.config.sandbox_enabled", false);

Hi, you can name the two files whatever you like, but you are correct that the name of the second file needs to be accurately indicated in the first file.