Closed tim-janik closed 10 months ago
We discussed something similar on Element a few months back, the suggested alternative for now was to add the search field as a search engine and then add a shortcut to it:
mosra (Vladimír Vondruš):
about the search, you can right click into the search field and "add as a search engine" on browsers that support custom search (vivaldi, firefox, opera does, not sure about plain chrome) i can even add a shortcut (such as mn for magnum) so e.g. mn pixelf in the url bar leads me straight to search results for pixel format
and if you don't have a browser with custom search engines you can bookmark ?query=
#search at least, to lead you to a page that has a search box with results already opened
That said, I'd also like to see integrated binding as well :)
You can open it by pressing T, which is consistent with GitHub file search (when you're on a file listing page, pressing that will allow you to quickly search for files with a fuzzy pattern). You can also use Tab that achieves the same. I chose that because on many websites it highlights the first form input, which is usually the search.
I think those two are more than enough. But I'll make sure to have them documented somewhere visible, for some reason it isn't. Actually it is shown, right at the top of the search box :eyes:
GitHub doesn't seem to understand Shift Alt F, so I don't think that's a "standardized" key binding. Plus, since it has to open a popup, just an accesskey
wouldn't be enough I think.
@mosra
Plus, since it has to open a popup, just an accesskey wouldn't be enough I think.
I just tested it via DOM editing and it seems to work OK (on Firefox, at least). It does do something slightly odd with the page layout if you press it twice (i.e. pressing it once again when the search dialog is visible), though it's a pretty minor cosmetic issue.
EDIT: Oh, I see. It's because pressing it multiple times causes showSearch()
to be called repeatedly, whereas normally this isn't possible without there first being a call to hideSearch()
. Hmmm. Probably just a if (window.location.hash == '#search') return false;
inside showSearch()
would be sufficient to prevent this.
I don't know, if anything I'd just add the key binding next to the other two in the javascript code, I don't see a reason to implement it in a completely different way.
And, again, I think two bindings are enough already, no need to have three. Having this configurable would mean each m.css-based site could have the hotkeys slightly different, which isn't any good for usability. There isn't any consistency across the web with Shift Alt F either, so let's don't mess it up further by also having each m.css search box behave differently.
And, again, I think two bindings are enough already, no need to have three.
Yeh, I'm inclined to agree. I'm just doing a bit of testing for the sake of learning how accesskey
works. @tim-janik I don't really think this adds any value, personally.
@tim-janik I'll add a hook to catch multiple calls to the search function so you can do your own overrides to it without worrying about breaking page state (e.g. using sed
to apply an accesskey
in your CI pipeline or wherever). I think that's a good middle ground, since T
and TAB
are already sufficient for the vast majority of users.
Thanks, I'm just used to accesskey="F" from Wikipedia, and indeed I'm using sed atm to add that to the first <a class="m-doc-search-icon"/>
element. You can test it out here: https://tim-janik.github.io/docs/anklang/
I don't see any page layout issues in Firefox though, and AFAICS a second/third key press does nothing if the search field is already activated.
I don't see any page layout issues in Firefox though, and AFAICS a second/third key press does nothing if the search field is already activated.
On my machine I see the RHS page margin being set to 17px
first time, then auto
after that. It's not a catastrophic effect by any measure; just looks a bit weird.
Is your feature request related to a problem? Please describe.
Wikipedia and many other sites support starting up Search on
Shift+Alt+F
. That'd be nice to have in Poxy output as well.Describe the solution you'd like
I.e. please add code to achieve the equivalent of:
Additional context
Other keys are also supported by Wikipedia, e.g. accesskey="z" to go to the Home/front page, but those aren't as frequently used/missed as
Shift+Alt+F
for search.