-
Notifications
You must be signed in to change notification settings - Fork 957
UX-3504 Search Field Guideline #1495
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
base: main
Are you sure you want to change the base?
Changes from all commits
1c57bbf
2a52fbc
7f8f8f7
4a21b13
e00d733
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,182 +10,96 @@ | |
|
||
</tldr> | ||
|
||
A search field is an input field that helps users locate objects, actions or text in an application. | ||
A search field is an [input field](input_field.md) that helps users locate objects, actions, or text. | ||
|
||
{width=400} | ||
|
||
This article focuses on the search field. | ||
{width=706} | ||
|
||
[//]: # (TODO: See another article for [search results](search_results.md).) | ||
|
||
## When to use | ||
|
||
Use the search field when specific objects are difficult to find at a glance, for example: | ||
Use a search field when specific objects are difficult to find at a glance: | ||
|
||
* There are many objects, for example, in the VCS Log table or in the Editor with a large file opened. | ||
* Objects aren't in a single location, for example controls are located on different setting pages. | ||
* There are many objects, as in the VCS Log table or in the Editor with a large file opened. | ||
* Objects aren't in a single location, for example, controls are located on different setting pages. | ||
|
||
## How to use | ||
|
||
### Label and Placeholder | ||
|
||
Do **not** add a label to the search field. The magnifying glass icon is self-explanatory. | ||
|
||
<format color="Red" style="bold">Incorrect</format> | ||
|
||
{width=360} | ||
|
||
<format color="Green" style="bold">Correct</format> | ||
### Label | ||
|
||
{width=360} | ||
Don't add a label <control>Search</control> to the search field. The magnifying glass icon is self-explanatory. | ||
|
||
Mark the replace field with a label or a placeholder when shown together with the search field to distinguish between them: | ||
|
||
{width=865} | ||
<table style="none" border="false"> | ||
<tr> | ||
<td><format style="bold" color="Green">Correct</format><img src="search_field_label_correct.png" width="378"/></td> | ||
<td><format style="bold" color="Red">Incorrect</format><img src="search_field_label_incorrect.png" width="378"/></td> | ||
</tr> | ||
</table> | ||
|
||
Provide hints and scope as placeholder text. | ||
For example, the placeholder for plugins' search depends on the settings page tab to make it clear that search depends on the tab: | ||
### Placeholder | ||
|
||
{width=581} | ||
Provide hints such as search scope as placeholder text. | ||
|
||
### Icons | ||
{width=706} | ||
|
||
#### Search Options | ||
### Search and Replace fields | ||
|
||
Use icon buttons inside the search field to save space and not to overload the UI and to be able to use them in already packed UI such as the Speed Search popup in trees or lists: | ||
Mark the Search and Replace fields with placeholders when shown together to distinguish between them: | ||
|
||
{width=400} | ||
{width=706} | ||
|
||
Available option icons: | ||
### Search options | ||
|
||
| {width=16} | Match case | | ||
|--------------------------------|--------------| | ||
| {width=16} | Regex | | ||
| {width=16} | Words | | ||
| {width=16} | In selection | | ||
{style=none} | ||
Use [icon buttons](icon_button.md) inside the search field to save space and not to overload the UI. | ||
|
||
Change the state of options icons on hover so that it is clear that they are clickable: | ||
{width="706"} | ||
|
||
{width=400} | ||
Icon buttons should change background color when enabled so that it is clear which options are currently enabled. | ||
|
||
Make icon buttons easily accessible with Tab navigation. | ||
Option icons should be placed on the right of the search field in the tabbing order. | ||
Show a border around the focused option. | ||
{width=706} | ||
|
||
{width=400} | ||
### Tab navigation | ||
|
||
Icon buttons should change color when enabled so that it is clear which options are currently enabled: | ||
Make icon buttons easily accessible with <control>Tab</control>. Focused button should have a colored border. | ||
|
||
{width=400} | ||
{width=706} | ||
|
||
#### Clear a Search String | ||
### Clear a Search String | ||
|
||
Show the clear button <icon src="../../../images/ui/search_field/icons/clear-light.png" /> only when filtering on-screen content. | ||
Show the <control>Clear</control> button <icon src="../../../images/ui/search_field/search_field_close_icon.png" width="20"/> when the search field has been filled. | ||
When the button is clicked, clear the search field and restore the content to its default state. | ||
Do **not** show the clear button if the search field is empty. | ||
|
||
{width=581} | ||
|
||
Do **not** show the clear button when the initial data state is empty or doesn't differ from the result. | ||
For example, the close icon is not really useful in the editor search field since matches are highlighted and not filtered: | ||
|
||
<format color="Red" style="bold">Incorrect</format> | ||
|
||
{width=419} | ||
{width=706} | ||
|
||
When search can be configured with options, show the clear button on the left of the option buttons. | ||
This way, option buttons won't jump when the clear button appears. | ||
The separator between the options and the clear button makes it harder to mis-click the potentially dangerous clear icon. | ||
|
||
{width=400} | ||
|
||
#### Multiline Search Strings | ||
|
||
Searching for multiline matches can be achieved with a separate New Line action button: | ||
|
||
{width=342} | ||
{width=706} | ||
|
||
Put the New line action button on the left of the option buttons: | ||
### Multiline search strings | ||
|
||
{width=300} | ||
If multiline search is needed, use the New Line <icon src="../../../images/ui/search_field/search_field_new_line_icon.png" width="16"/> action button. It should be placed on the left of the rest of the search options. | ||
|
||
Move the New Line action button below the option buttons when the search field becomes a multi-line one: | ||
{width=706} | ||
|
||
{width=300} | ||
The default shortcut for the New Line action: <shortcut>⇧⌘⏎</shortcut> for macOS and <shortcut>Ctrl + Shift + Enter</shortcut> for Windows/Linux. | ||
|
||
Add a vertical separator when the scrollbar appears: | ||
### Filters | ||
|
||
{width=300} | ||
Provide filters for complex searches. Don't use filter attributes in the search query. | ||
|
||
The default shortcut for the New Line action: | ||
|
||
<table style="header-column"> | ||
<tr> | ||
<td>macOS</td> | ||
<td><shortcut>⇧⌘⏎</shortcut></td> | ||
</tr> | ||
<tr> | ||
<td>Windows/Linux</td> | ||
<td><shortcut>Ctrl + Shift + Enter</shortcut></td> | ||
</tr> | ||
<table style="none" border="false"> | ||
<tr> | ||
<td><format style="bold" color="Green">Correct</format><img src="search_field_attributes_correct.png" width="378"/></td> | ||
<td><format style="bold" color="Red">Incorrect</format><img src="search_field_attributes_incorrect.png" width="378"/></td> | ||
</tr> | ||
</table> | ||
|
||
### Completion | ||
|
||
Provide completion for complex searches with filtering by attributes: | ||
|
||
{width=354} | ||
|
||
Do **not** use filter attributes as separate controls on the toolbar. | ||
Not all of them are needed every time while they take a lot of space and overload the interface. | ||
Use completion instead: | ||
|
||
<format color="Red" style="bold">Incorrect</format> | ||
|
||
{width=550} | ||
|
||
<format color="Green" style="bold">Correct</format> | ||
|
||
{width=550} | ||
|
||
The following syntax is used for attributes: | ||
|
||
* Binary attributes are marked with a number sign (#), for example, _#by-jetbrains_ to show plugins which are developed by JetBrains. | ||
|
||
* Values for open attributes are provided after a colon, for example, _status: disabled_ to show all disabled plugins. | ||
|
||
Provide aliases to the main attributes where possible, this way it would be easier for users to find the required filter. | ||
For example, the User attribute in the VCS Log search field can have the Author alias. | ||
|
||
Show a popup with search attributes when the field gets focus, and after each space character except the space character following an attribute's name. | ||
This will make it clear that filtering by attributes is available. | ||
|
||
Filter out the completion suggestions as the user types: | ||
|
||
{width=354} | ||
|
||
Show a popup with values right after the user has entered an attribute. | ||
|
||
{width=354} | ||
|
||
### Search History | ||
|
||
Use the magnifying glass icon with an arrow when search history is available: | ||
|
||
{width=250} | ||
### Search history | ||
|
||
And without an arrow when it's not: | ||
Use the magnifying glass icon with an arrow when search history is available. Show search history in a popup when clicking on the magnifying glass icon. | ||
|
||
{width=250} | ||
|
||
Show search history in a popup when clicking on the magnifying glass icon: | ||
|
||
{width=256} | ||
|
||
Show context help in the history popup when it is empty: | ||
|
||
{width=256} | ||
{width=706} | ||
|
||
The keyboard shortcut for the History action is <shortcut>Alt + Down</shortcut> on all systems. | ||
|
||
|
@@ -198,98 +112,44 @@ Add a search string to history: | |
|
||
### Placement | ||
|
||
Put the search field on top of the on-screen content that is being searched, and align them vertically. | ||
For example, the search field in <control>Settings</control> dialog is aligned with the filtered settings tree: | ||
|
||
<format color="Green" style="bold">Correct</format> | ||
|
||
{width=256} | ||
|
||
The search field is not aligned with the content on the Keymap settings page, which makes it harder to relate the content and the search string: | ||
|
||
<format color="Red" style="bold">Incorrect</format> | ||
Put the search field on top of the content that is being searched and align them vertically. | ||
For example, the search field in <control>Settings</control> dialog is aligned with the filtered settings tree. | ||
|
||
{width=491} | ||
{width=706} | ||
|
||
<format color="Green" style="bold">Correct</format> | ||
<!-- #### Inline search | ||
|
||
{width=491} | ||
Fit the search field to a popup window or to a toolbar if it has top borders. This way the overall form looks less complex. | ||
|
||
Fit the search field to the popup windows and to a toolbar if it has top borders. This way the overall form looks less complex. | ||
<table style="none" border="false"> | ||
<tr> | ||
<td><format style="bold" color="Green">Correct</format><img src="search_field_placement_correct.png" width="378"/></td> | ||
<td><format style="bold" color="Red">Incorrect</format><img src="search_field_placement_incorrect.png" width="378"/></td> | ||
</tr> | ||
</table> --> | ||
|
||
<format color="Red" style="bold">Incorrect</format> | ||
#### Speed Search | ||
|
||
{width=475} | ||
Show the search field on demand when search is supplementary to other functionality or if space is limited. The search field should be accessible with <shortcut>cmd+F</shortcut> on macOS and <shortcut>Ctrl + F</shortcut> on Windows/Linux. | ||
For example, space in the Project view is limited and too loaded to always show the Search bar: | ||
|
||
<format color="Green" style="bold">Correct</format> | ||
|
||
{width=475} | ||
|
||
| <format color="Red" style="bold">Incorrect</format> | <format color="Green" style="bold">Correct</format> | | ||
|-----------------------------------------------------|-----------------------------------------------------| | ||
| {width="235"} | {width="235"} | | ||
|
||
Show the search field on demand when search is supplementary to other functionality or if space is limited. | ||
For example, space in the Project view is limited and too loaded to always show the _Speed Search_ bar: | ||
|
||
{width=360} | ||
|
||
When searching through content that is not displayed on the screen, put the search field on top of the active frame as a popup. | ||
This makes it more prominent and gives space for search results. | ||
For example, Search Everywhere is shown on top of the main IDE frame: | ||
|
||
{width=686} | ||
{width=706} | ||
|
||
### Sizes | ||
|
||
For a search field shown without a toolbar (i.e. _Speed Search_ in trees), the search width could be adjusted on typing to accommodate input: | ||
|
||
{width=160} | ||
|
||
For a search field that is not fitted to a toolbar, set the minimum width to 200: | ||
|
||
{width=425} | ||
|
||
For a search which is fitted to the toolbar, expand the field to the toolbar width. | ||
|
||
Center-align icons and the search string with the one-line search field vertically. Adjust the right and left paddings to the higher search fields: | ||
|
||
{width=297} | ||
|
||
{width=296} | ||
|
||
Save the position of the search and option icons when the search field becomes a multi-line one: | ||
|
||
{width=250} | ||
|
||
### Spaces | ||
|
||
Between the floating search field and on-screen content: | ||
|
||
{width=265} | ||
|
||
Between history and the search field: | ||
|
||
{width=269} | ||
|
||
Between search string and completion popup: | ||
|
||
{width=266} | ||
|
||
Completion popup: | ||
|
||
{width=95} | ||
#### Grouped with other controls {#grouped-search-size} | ||
|
||
## Style | ||
For a search field which is displayed as an input field in a group of controls, for example, in a tool window toolbar, follow the [input sizes guideline](input_field.md#sizes-and-placement). | ||
|
||
### Colors and Fonts | ||
#### Above lists and trees {#list-trees-search-size} | ||
|
||
For a general search field, use the same colors as for an input field. | ||
When placed above lists or trees, expand the field to the width of the list or tree. | ||
|
||
For a search field that is fitted to the toolbar, use a narrower focus border on macOS. The border width is 2px in that case: | ||
{width=475} | ||
#### Speed search {#speed-search-size} | ||
|
||
Use the same font for the search string as used for showing the results. | ||
For a search field shown on demand, for example, in the <control>Project</control> tool window, expand the field to the width of the tool window. | ||
|
||
Use the Context help font color for the attributes' names as they are secondary to their values. | ||
<!-- #### In a toolbar {#toolbar-search-size} | ||
|
||
* For a search field shown without a toolbar, for example, Search in trees, the search width could be adjusted on typing to accommodate input. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does it mean the field is resized as the user types more? does it really work this way? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it does. But it's the speed search that is mentioned here, I'll change 'without a toolbar' because it's vague |
||
* For a search field that is not fitted to a toolbar, set the minimum width to 200 px. --> |
Uh oh!
There was an error while loading. Please reload this page.