Add keyboard shortcuts for the frequently used interface elements. This will help Tolokers because keyboard combinations are somewhat faster than mouse clicks.
In Toloka, shortcuts are particularly helpful because Tolokers will do your tasks faster and you can pay less for them. If your project has a low score for “Interface usability“, adding shortcuts will help improve the rating.
Shortcuts are digits or letters shown next to buttons. Shortcuts help Tolokers do an action by pressing a key.
A shortcut is always added to a button if they do the same thing.
Keyboard shortcuts are independent of the interface. They work even if they are not displayed, like if you set up a shortcut without setting up a button.
Some components provide additional ways for setting up shortcuts. For example, the field.image-annotation component has its own plugin.
Use a separate plugin to configure shortcuts: plugin.hotkeys. Use this plugin to assign keys to actions. Plugins are added to the plugins
array in the configuration root.
{ "type": "plugin.hotkeys", "p": { "type": "action.play-pause", "view": { "$ref": "view.items.0" } }}
In this example, pressing P triggers the action.play-pause action. It starts or pauses playback in the player. The player is specified in the view
property by using the $ref structure, which links to another place in the configuration.
Mind the keyboard layout when setting up shortcuts: if you choose a character that looks similar in the Cyrillic and Latin layouts, it might confuse Tolokers.
Use the action.set component to set up shortcuts for radio buttons. For checkboxes, use action.toggle. Assign shortcuts to actions that your radio buttons or checkboxes do.
View exampleYou can reuse shortcuts just like any other code fragments. To do this, use the structure { "$ref": "path.to.element" }
. Reuse is helpful when you need to insert the same shortcuts in multiple places in your code.
Put your reused code into vars
so that you don't have to change the path in the $ref
property when you change the configuration.
For a Toloker to trigger multiple actions by pressing a button, add the action.bulk component. For example, you can use it to show multiple notifications.
View exampleIf you use a condition (helper.if or helper.switch), also add it to the shortcut to ensure consistency.
If you set up a shortcut without a condition, the shortcut will still work, but won't be visualized. This might cause errors.
Here is an example of an error. In this example, if Tolokers respond Yes, they see another question. But they can use a keyboard shortcut to respond to it, even if it's not shown in the interface.
View example with error in the sandbox.
View exampleView corrected example in the sandbox.
View exampleTo display a shortcut in the interface, set the shortcut to the same action that is performed when the button is clicked.
Assign an action to the component if you haven't yet:
You can see the full list of actions in List of actions.
Keep in mind the following:
“true”
string to the results, and the Boolean value true
is defined for the shortcut.Last updated: August 2, 2023