I'm developing a search bar. The input field and the icon are uniform in design, and thus a tabable icon feels superfluous because the default behaviour when pressing the enter key while the input field has focus is to submit the form. Hit tab>enter and you're achieving the exact same. However the icon is a clickable button, which I believe is a necessity. Should there be a 1:1 relationship between tabbing and clicking? Meaning if something is clickable, then it needs to be tabable?

The search bar in question

Another challenge is the "X" left of the search icon, having the role of clearing the input. Because it has a behaviour different to the default one of the input field, I feel like it should be tabable. But at the moment it feels like I'm tabbing backwards when giving it focus. It also looks a little weird in its focused state.

enter image description here

Any input on this situation? Thanks.

  • Do you need an X icon at all? What's wrong with clearing the field by holding down delete or pressing Ctrl-A Delete? And without the X, there's nothing to tab at all since the search icon does the same as hitting enter when the text field has focus. – BallpointBen Oct 15 at 18:50
  • 2
    @ballpointpen it can be a slight pain to clear a search bar with lots of text if there's no button, especially on mobile. I certainly would be annoyed if it weren't on a search bar I was using. – Kat Oct 15 at 21:16

Overview

You created this UI element to allow users to easily clear their search input criteria. In most cases users who use their keyboard to interact with the form will be choosing the search button over the clear button as this is the primary action. By using keyboard navigation your first concern would be your indexing order, should clear come before search or not at all?

Tabable?

In my opinion good design is inclusive, some users may be using assistive technology. Removing clear from the index removes this feature from these users. That being said, yes you should make the clear button indexable.

Clear before search or search before clear?

It has become commonplace that to complete the primary action in a form you press Enter. In most cases users will expect that the tabbing order does not change from common designs (top to bottom, left to right). The user should tab into the input field, tab to access clear, and finally tab to access search. At any time you can press enter to submit the search as long as your focus is in the form (input field).

Things to consider

  • Information Architecture

Since "clear" is specific to this input field and not the form (even though the form only has one input field), it makes sense to put the clear button inside the input field (very common UI architecture Parent->child). However, the "Search" icon is your form's primary action. It makes more sense to put this outside of your input field. This will keep all forms following the same information architecture.

  • Textual Call to action

If there see search results, does "clear" also remove the results or just the input in the form? The "Close", "Delete", "Stop" icon is holistic and is not representative of exactly what the action is you're trying to inform the users of. Consider removing this icon and just use text to tell users what this does. Perhaps use a tool tip, but don't forget to use alt="" attribute for those on screen readers.

The same consideration could apply to the search call to action. Right now you're using a label to inform us of the input fields action not what the input field is. However, you can achieve this by using "Search" as the action and not the label. This again will keep all forms following the same patterns and removes any ambiguity.

Since search is at the top of your site, users read top to bottom, left to right. At the time of seeing this input field, they may have little context of what it does. Does this search products, contact info, blogs, search engines? Try to let your call to actions be clear and concise, for example "search products". If there is not a lot of room, you can use placeholder text to convey this to the users.

Never make the user think. "Don't make me think"

  • 1
    "The user should tab into the input field, tab to access clear, and finally tab to access search." "Never make the user think." Putting that clear button in the tab order between the input and the Search button would make me think. Actually, it would make me think, curse, and view the entire site/app from that point forward with suspicion and distain. No, that clear button should not be tabbable if doing so means it sits between the input and the Search button in the tab order. Move it, remove it, or don't make it tabbable. – T.J. Crowder Oct 15 at 16:26

As a user I would expect, and I assume you're apply tab as a verb when you say "tabbable," the search to be performed when I tapped or clicked the search icon or the control lost focus.

I would expect the clear button to require and physical tap to clear the input.

If you included the clear button in the tab list, it strikes me that it would become quite irritating and people would inadvertently delete their search term.

I think you should make a stance at this situation since both behaviors are valid. Ask yourself: Is this a behavior you'd like to encourage? Do you want your users to hit tab>enter, or simply hit enter? I myself in favor of simply hitting enter, and not allowing tab>enter. Advanced users who use the keyboard will most probably hit enter, mouse users will probably too, but in case they don't you have the search button.

I would suggest making the search icon to be replaced by the X when a user searches. If the user presses the X button, the input is deselected and the X is replaced with the search icon again.

  • I should've adressed this in my question. Yes, the X is great for clarity and disincentivizing searching for the exact same term. But I see great value in having both visible at the same time so a user does not have to spam backspace. E.G. I have a autocomplete dropdown, and if you key down you may get some long search terms placed in the input field, thus the value of a clear button if no suggestions satisfied the user. – Audun Olsen Oct 15 at 14:19

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.