Accessibility support
We aim to simplify accessibility support as much as possible. Depending on the platform, DivKit automatically assigns the correct types to text
, input
, select
, slider
, tabs
, and similar objects. However, we can't automatically provide the user with additional information, set a correct description
, or perform other actions requiring the developer's input. Because of this, image
and separator
objects are excluded from accessibility by default.
If an element supports single- or double-tap actions, it's automatically announced by the accessibility services on both Android and iOS platforms.
To configure accessibility, you can use the accessibility
object. Example:
"accessibility": {
"type": "button",
"hint": "Tap on the button to play music.",
"description": "Play music",
"state_description": "Clicked",
"mode": "merge"
}
type
: Element role. It is used for correct identification of an element by an accessibility service.hint
: Tooltip describing what will happen if the user interacts with an element. It's voiced after thedescription
field.description
: Element's main description.state_description
: Description of an element's current state. For example, for a switch, the state can be eitheron
oroff
.mode
: How the accessibility tree is structured. There are three modes available:default
: Process the element and its entire subtree separately.merge
: Treat the element and its entire subtree as a single entity.exclude
: Make the element and its entire subtree unavailable for the accessibility object.
Element roles
none
: Undefined element role.button
: Button type. If an element has active actions for single or long taps, this is also announced to the user.image
: Image type. We can't provide details about your images, so we recommend specifying adescription
for this type.text
: Text type.edit_text
: Text input type.header
: Header type.list
: List type. The elements inside are voiced one after another.auto
: Automatic type assignment. This is the default type.
Learn more
Follow DivKit news in the Telegram channel: http://t.me/divkit_news
You can also discuss topics of interest in the DivKit user community in Telegram: https://t.me/divkit_community_ru