Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcut for "Select the page's main/top frame"? #125

Closed
alon-to opened this issue Jan 1, 2018 · 7 comments
Closed

Shortcut for "Select the page's main/top frame"? #125

alon-to opened this issue Jan 1, 2018 · 7 comments

Comments

@alon-to
Copy link

alon-to commented Jan 1, 2018

(I posted this feature request on January 1, and have meant to clarify the whole year -- finally doing it!)

I'd love to have a keyboard shortcut that mimics Vimium's gF binding for "focus the main/top frame". Unlike Vimium's solution, a ShortKeys shortcut would work in the URL bar and in input boxes.

Personally my user journey would be to move through these steps in lightning speed:

  1. Jump out of the URL bar or out of an input box using the ShortKeys shortcut, then
  2. Use keyboard shortcuts to navigate the page (scrolling and opening links, primarily using Vimium bindings)

Jumping out of the URL bar or input boxes can (usually) be accomplished by hitting TAB some number of times, with the exact number depending on both what's currently in focus and the page that is loaded. Some example of inconsistencies:

  • Focus on URL bar, and hitting TAB: focus shifts to the page while scrolling to the top of page (undesirable). I believe it's possible that focus might actually move to an input box, which would require one or more additional TABs.
  • Focus on URL bar, having started typing something, and hitting TAB: Chrome scrolls through suggested queries in the URL bar
  • Focus on input box with a scroll bar such as github's comment editing box, and hitting TAB: focus shifts to the scroll bar. Hitting TAB a second time moves focus to a link inside the main frame.
  • Focus on input box with no scroll bar such as the searchbox at the top of github.com, and hitting TAB: focus shifts to the main frame.

A keyboard shortcut that accomplishes step 1 in my user journey irrespective of the state of the browser would be divine, but the differences in behavior in the scenarios described mean that instead I first must identify which area of my browser is in focus, potentially hit ESCAPE to remove anything typed in the URL bar, and then hit TAB until I recognize that focus is in the main frame.

I tried to articulate all the details here but super happy to give more details!

(Absolutely love this extension -- many thanks in advance!)

@alon-to alon-to changed the title Is there a shortcut for "Set focus forward"? Shortcut for "Set focus forward"? Jan 1, 2018
@crittermike
Copy link
Owner

@alon91 nice requests, thanks!

  1. "I'd like a keyboard shortcut that works even if I start erroneously typing inside the address bar when I didn't realize it has focus." - I'm kind of fuzzy on what you're really asking for here. What's the end goal you're trying to accomplish?
  2. "Use the "Set focus forward" shortcut" - so you basically just want to be able to switch focus from the address bar to the page itself? Doesn't the tab key do this?

Thanks again, and sorry about my confusion!

@alon-to
Copy link
Author

alon-to commented Oct 27, 2018

@mikecrittenden I totally revamped my question to clarify the ask. The challenge is that the TAB key is inconsistent based on the state of the browser. All the details are in the original post but super happy to further clarify. Many thanks!

Maybe to really clarify I'd love to be able know that the following sequence will always work irrespective of the state of my browser:

  1. Hit a ShortKeys shortcut to focus on the main frame
  2. Hit f to activate Vimium hints

@alon-to alon-to changed the title Shortcut for "Set focus forward"? Shortcut for "Select the page's main/top frame"? Nov 26, 2018
@crittermike crittermike reopened this Nov 28, 2018
@crittermike
Copy link
Owner

Closing some old tasks, feel free to comment if this is still an issue.

@alon-to
Copy link
Author

alon-to commented Dec 24, 2019

Hi Mike! I'm an absolutely avid Shortkeys user -- thank you so much for creating such an amazing extension!

This may be a niche feature but I would so so so love to have it. Would regularly save me a bunch of keystrokes when I'm trying to figure out whether my browser's focus is in the URL bar, some text box, the page itself, or something else altogether. Happy to provide more supporting details, use cases, etc. if clarification would be helpful!

@crittermike
Copy link
Owner

Heya @alon91 - I spent some time digging into this request and researching and I'm not sure what you're asking for is possible.

I found these links (which you may have already seen):

I also dug through the extension API. I just can't seem to find a reliable way to programmatically change focus to the web page itself, especially if the cursor is in the omnibar. Do you have any ideas about how this could be accomplished by any chance?

@crittermike
Copy link
Owner

I also dug through everything on https://developer.chrome.com/extensions/api_index as well as philc/vimium#226 to see if maybe there's a hidden API for changing the focus, but I don't see one. The "best" workaround that I've found is to hit ctrl+f (to focus the webpage and open the find dialog) and then immediately his esc to close it, but unfortunately that's not something that Shortkeys has the ability to do programmatically. :(

@alon-to
Copy link
Author

alon-to commented Feb 14, 2020

Thanks so much for the reply and apologies for not responding here sooner! I really appreciate you digging in and providing all these great links.

For the last several years I've been using the solution in this thread: I created a Chrome custom search engine that points to the Query URL javascript: and mapped it to the letter 'u'. When I'm in the address bar and want to exit I remove anything in the URL bar, and hit u + enter.

If Shortkeys can run javascript via a shortcut while the cursor is in the URL bar then perhaps this is an answer?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants