Skip to content

docs: semantics docs#635

Open
lancesnider wants to merge 8 commits intomainfrom
accessibility
Open

docs: semantics docs#635
lancesnider wants to merge 8 commits intomainfrom
accessibility

Conversation

@lancesnider
Copy link
Copy Markdown
Collaborator

@lancesnider lancesnider commented Apr 24, 2026

Remaining todo's:

  • Feature support (just need versions)
  • There's at least one page that says we don't support semantics
  • Runtime flags
  • Images (waiting for UI updates)

@lancesnider lancesnider requested a review from a team as a code owner April 24, 2026 22:43
@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Apr 24, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
rive 🟢 Ready View Preview Apr 24, 2026, 10:45 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Comment thread docs.json Outdated
]
},
{
"group": "Accessibility & Interaction",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall us chatting about this, but I don't remember why we landed on & Interaction?

I'd prefer just Accessibility.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was to better encompass focus, but I think "Accessibility" is good enough. :thu


At a high level, semantics are made up of:

- [Type](#semantic-type) — what the element is (for example, button, image, or heading)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Type but Role


Semantics describe what an element is and how it should be understood. Adding semantics makes your experiences accessible, allowing screen readers to correctly describe and navigate your content.

At a high level, semantics are made up of:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also include Semantic Actions somewhere.


Semantics describe what an element is and how it should be understood. Adding semantics makes your experiences accessible, allowing screen readers to correctly describe and navigate your content.

At a high level, semantics are made up of:
Copy link
Copy Markdown
Contributor

@HayesGordon HayesGordon Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this description for Roles, Traits, and States:

Architecture: Role / Trait / State

  • Role - what the node is (button, checkbox, tab, etc.)
  • Trait - what the node can do (expandable, selectable, checkable, etc.)
  • State - what the node is doing (expanded, selected, checked, etc.)

Some state flags are only meaningful when their corresponding trait is set. Without the trait, the platform sees the property as not applicable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. 👍

- [Type](#semantic-type) — what the element is (for example, button, image, or heading)
- [Properties](#semantic-properties) — additional information like label, value, or hint
- [Traits](#traits) — capabilities an element has (for example, selectable or expandable)
- [State](#state) — the current value of a trait (for example, selected or disabled)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all states relate to a trait. It's just that some states are gated by a trait

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between a locked trait and a traitless state? What makes enableable a trait with a lock icon and obscured not a trait?

CleanShot 2026-04-28 at 16 00 02@2x

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind. Your other comment explains it " Some state flags are only meaningful when their corresponding trait is set. Without the trait, the platform sees the property as not applicable."


## Adding Semantics

<img src="/images/accessibility-interaction/semantics/adding-semantics.gif" width="300" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be immediately clear where to find this, as the video doesn't show it's the inspector

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

btw There are other gifs to add, but the ui is still WiP.

<Step title="Add Semantics">
Select an element in your scene. In the right sidebar, click the `+` button in the **Semantics** panel to enable semantics for that element.
</Step>
<Step title="Choose a Type">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Role not Type

For example, a slider that controls volume might have the label:
`Volume`

<Info>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this. This is true, but not all platforms and screen readers are equal. For example, the web might announce "expanded", but iOS does not. There might be times when authors want to provide a more unique experience by controlling the label instead of relying on the role.

Avoid including the type in the label (for example, "slider" or "button"). Screen readers already announce the element’s type.
</Info>

<Info>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a new section called "Semantic Inference".

Here we can detail that certain Rive components will infer it's label (and other properties) automatically. At this time it's only a Text component that will automatically set its label to the text set.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna push back a little. :)

Inference isn't a sibling section to traits and properties, it's a child of both. It's also not something you need to learn about - it feels like something most people will figure out on their own.

The only time people might look for it in the docs is if they've added a text field and can't figure out why they can't change the role. In that case, they'll go to the "Role" section, not the "semantic inference" section.

Some elements, like text inputs, automatically infer their semantic type.
</Info>

## Semantic Properties
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to state the type these properties should be. At this stage it's all strings, but maybe in the future we others.


For example, an element with the **selectable** trait will have a **selected** state.

Use data binding to keep semantic states in sync with your Rive file. For example, bind a boolean from your view model to the **toggled** state of a switch.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also key the state on an animation timeline


Small issues—like a missing label or incorrect state—can make elements confusing or unusable for screen reader users.

### How to Test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth calling out that this should be tested at runtime, and not the editor. Or maybe soon we can say the mirror apps

description: ""
---

Semantics describe what an element is and how it should be understood. Adding semantics makes your experiences accessible, allowing screen readers to correctly describe and navigate your content.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point early in the document, we should highlight that this is in Early Access, and that runtime support is currently in development or released as experimental.

Inconsistencies should be reported to us, but it's worth noting that not all Roles we expose are valid across every runtime. We will document these over time.

We also need a runtime page to detail how to enable (opt-in at this stage), plus how to test etc. But that can be a separate PR.

Then we also need to update the feature support page to list out the state of this feature support on runtimes. Currently we can say that Flutter has experimental support from version 0.14.6

tylernij
tylernij previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Collaborator

@tylernij tylernij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gordon has some suggestions but afterwards 👍

@lancesnider
Copy link
Copy Markdown
Collaborator Author

Thanks @HayesGordon and @tyler. I've implemented most of your feedback, though there are a couple of todo's I'll add to the description.

Comment thread runtimes/web/text.mdx

#### Adding ARIA Label

At a minimum - if it is important to convey the text value displayed in the Rive animation to all users, add an `aria-label` to the `<canvas>` element with the text value from the animation. Screen readers may read this label out immediately as it parses out the DOM contents. You'll also want to add `role="img"` to the `<canvas>` element as well.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this small aria label section could still be useful as a "at a minimum, if semantic nodes are not used in your Rive graphic"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants