I like the idea of the new search feature which can certainly replace the coffee module. Are you considering implementing a hotkey to open the search bar and set the cursor into that field?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jurgenhaas created an issue. See original summary.

oknate’s picture

I don't use hotkeys, so I haven't thought of it. Can you give more detail of how you'd like it to behave? This is a major feature of the coffee module I know.

jurgenhaas’s picture

Thanks for your reply. The way this works in coffee - similar to e.g. the Alfred tool on the Mac - when you hit the hotkey (Alt-K if I remember correctly) their dialog box pops up in the middle of the screen and the textfield has the cursor focus so that you can start typing without leaving your fingers from the keyboard.

With your admin toolbar there should NOT be any change in the UI from my point of view. Instead, when the hotkey gets pressed, the cursor focus should be the textfield in your search panel, which if not visible yet, should be made visible first.

For the site builder this would mean, they can hit the hotkey followed by typing their search string which will immediately show the search results which they can select with up and down keys plus return/enter to get there.

Does that make any sense?

oknate’s picture

Yes, thanks for the explanation. Is it configurable in coffee? So you can switch hotkeys?

jurgenhaas’s picture

Is it configurable in coffee? So you can switch hotkeys?

AFAIK, it's not.

jigarius’s picture

I was thinking about this same thing! If we build it in admin toolbar, I will no longer need to install Coffee on any projects. I will create a patch for it ASAP (I was going to do it this weekend, but then I fell sick 😷).

What do you think the shortcut should be? Shall I make it the same as it is in Coffee?

jurgenhaas’s picture

@jigarius sounds great. As a default, the same as coffee would make a lot of sense. Of course if you could allow that to be configured, that would be even better.

adriancid’s picture

I think should be different from Coffee because maybe some users will continue using Coffee and if we use the same this can create problems.

jigarius’s picture

Yes Adrian. I've thought about that. I might simply check if Coffee is enabled. If it is enabled, then I can setup a different shortcut. Also, I think I might just make it configurable.

adriancid’s picture

Is better to keep this module without configuration, we can choose another combination, in my opinion, if we use the same as Coffee and a user has the two modules installed we may be forcing him to don't use a module he maybe loves to use.

jigarius’s picture

Ok. Point noted.

As a side note, I always wanted to provide a configuration for this module to allow people to choose the toolbar color (: Do you think that's a good idea?

adriancid’s picture

@jigarius the project owner @eme always says he wants to keep the module plug and play and without configuration. I think we need to see his opinion about the colors for the toolbar.

jigarius’s picture

Ok. Then for now I'll just create a shortcut for the search and keep the frills and decorations for other issues. Thanks for the quick replies.

eme’s picture

Hello !

I love the coffee module as well :-)

It may be interesting to include it into Admin toolbar, but woudn't be interesting to include the coffee module directly as a submodule and talking with the maintainer of the module ?

I talked to romainj the co-maintainer of the module who is refactoring a significant part of the module, so just to know that there will be some changes to come in the module code.

jigarius’s picture

Title: Hotkey for new search feature » Create keyboard shortcut to toggle access the search functionality
Status: Active » Needs review
FileSize
8.32 KB

Here's the first iteration.

* Did some coding standard fixes.
* Created utility methods: isSearchVisible() and togglSearch()
* Create shortcut "Alt + S" / "Option + S" to toggle the search
* When the search is open, pressing "Escape" hides the search
* Installed Coffee and tested both of them to be working without conflict

Let me know if I missed something or if you have any suggestions (:

adriancid’s picture

Status: Needs review » Reviewed & tested by the community

Works fine for me, @eme you're correct with the shortcut?

oknate’s picture

Status: Reviewed & tested by the community » Needs work

Excellent work. This is great. And the clean-up of coding standards is great. I just have one nit with the experience. When you press escape, it closes the toolbar, instead of returning you to where you were. So let's say you're on the manage tab, you press Alt + S and go to search, and for some reason you decide not to search, so you press Escape, right now, the entire toolbar closes. I think it should return you to your last tab, if available.

Suggested UX improvement when pressing escape:

If the toolbar was open when pressing Alt + S:

  • The toolbar should not close.
  • You should return to the tab you were on before pressing Alt + S

If the toolbar was closed when pressing Alt + S:

  • The toolbar should close.
jigarius’s picture

Status: Needs work » Needs review

A nice observation. However, in my opinion that should be tackled in a different issue.

* The admin toolbar in general doesn't provide any nice way to know which tab is active.
* Also, using the shortcut to open the search bar is the equivalent of clicking on the "search" tab itself. And just like any other tabs, there is no way to press escape and jump back to the tab which was previously active (the other tabs don't behave that way either).
* Also, from a UX point of view, if a user is actually trying to activate the search, its highly probably that they'll type something and follow one of the autocomplete suggestions to land on a different page. And curiously, in this case, the admin toolbar currently lets the search tab open.

So, I believe that this ticket should probably restrict its scope to fixing the problem of having a shortcut for the search. We can however create another issue to improve:

* To maintain history of tabs clicked – at least when the user goes to the search tab.
* Then, whether the user collapses the search, presses escape or actually uses the search, the admin toolbar should restore the tab which was active right before the search tab was clicked.

If what I said above doesn't make sense and you believe that the UX improvement mentioned in comment 17 is absolutely necessary to be able to close this ticket, then please mark it as "Needs work" and I'll see if I can spend some time on it this weekend.

oknate’s picture

Status: Needs review » Reviewed & tested by the community

I think it's worth getting this in the way it is. Marking back to RTBC. The UX improvement isn't a must (#17) isn't a must. I can look into it as a follow up issue.

This is a great new feature.

adriancid’s picture

Title: Create keyboard shortcut to toggle access the search functionality » Create a keyboard shortcut to toggle access the search functionality
Status: Reviewed & tested by the community » Fixed

Thanks to @all

  • adriancid committed 5f49b89 on 8.x-1.x authored by jigarius
    Issue #3056856 by jigarius, jurgenhaas, adriancid, oknate, eme: Create a...
adriancid’s picture

Hi @jigarius can yo write a change notice for this new feature?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ExceptionHandler’s picture

Alt+s (Option+s) happens to be a shortcut to type a Polish character of "ś". I imagine there are other languages with common problem. Can you suggest how to turn this off, please?

adriancid’s picture

I think is better if we choose another different combination, can you propose another different shortcuts?

oknate’s picture

Can we move this to a follow-up?

#3087173: Allow shortcut key to be configurable

JasonLuttrell’s picture

This did not apply for me. Perhaps it's outdated now? Any chance of this patch being updated?

paulocs’s picture

That implementation was not ported to the 8.x-2.x version