Soushi-Atsumi / Open-in-Sidebar

Very simple and useful extension. You can open a link in the sidebar.
https://addons.mozilla.org/en-US/firefox/addon/open_in_sidebar/
Mozilla Public License 2.0
21 stars 2 forks source link

Open in sidebar key combination? #13

Closed Octur1s closed 7 months ago

Octur1s commented 7 months ago

Hello, I was wondering if it is possible to bind opening a link in the sidebar to a key combination when clicking a link.

For example, if I press CTRL+Click or middle click on a link it opens in an unfocused new tab, and if I SHIFT+Click a link it opens in a new window, and if I CTRL+SHIFT+Click an link it opens in a new focused tab.

So would it be possible to have a combination such as SHIFT+ALT+Click to open link in the sidebar instead of using a right click menu item?

Thank you!

Soushi-Atsumi commented 7 months ago

Hi, Octur1s Sadly it is impossible. To open the sidebar, it must be performed by user actions. According to the documentation, user actions are the following:

  • Clicking the extension's browser action or page action.
  • Selecting a context menu item defined by the extension.
  • Activating a keyboard shortcut defined by the extension (this only treated as a user action from Firefox 63 onwards).
  • Clicking a button in a page bundled with the extension.

User actions - Mozilla | MDN So opening a link in the sidebar by clicking a link with key combinations is impossible.

Octur1s commented 7 months ago

Ah I see, Out of curiosity, in regards to "Clicking a button in a page bundled with the extension." - would buttons added by an extension work to count as a user action?

Such as a special menu item that shows up next to a link when hovered or highlighted - similar to a feature in edge:

Animation

Soushi-Atsumi commented 7 months ago

Unfortunately, it is not counted as a user action. The document says

Note that user actions in normal web pages are not treated as user actions for this purpose.

The button which is added by an extension is treated as one of an element of a normal web page, so it cannot trigger a user action.

Octur1s commented 7 months ago

Alright, thank you for answering - and for making this extension!