primevue-mirror/apps/showcase/doc/togglebutton/AccessibilityDoc.vue

53 lines
1.8 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText id="accessibility" label="Accessibility" v-bind="$attrs">
<h3>Screen Reader</h3>
<p>
2024-09-11 07:54:05 +00:00
ToggleButton component uses a native button element as the switch element internally that is only visible to screen readers. Value to describe the component can be defined with <i>aria-labelledby</i> or <i>aria-label</i> props, it is
highly suggested to use either of these props as the component changes the label displayed which will result in screen readers to read different labels when the component receives focus. To prevent this, always provide an aria label that
does not change related to state.
2023-02-28 08:29:30 +00:00
</p>
2024-01-30 08:16:35 +00:00
<DocSectionCode :code="code" hideToggleCode hideStackBlitz v-bind="$attrs" />
2023-02-28 08:29:30 +00:00
<h3>Keyboard Support</h3>
<p>Keyboard interaction is derived from the native browser handling of checkboxs in a group.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr>
<td><i>tab</i></td>
<td>Moves focus to the button.</td>
</tr>
<tr>
<td><i>space</i></td>
<td>Toggles the checked state.</td>
</tr>
</tbody>
</table>
</div>
</DocSectionText>
</template>
<script>
export default {
data() {
return {
code: {
2023-09-22 12:54:14 +00:00
basic: `
<span id="rememberme">Remember Me</span>
2023-02-28 08:29:30 +00:00
<ToggleButton aria-labelledby="rememberme" />
2023-10-15 09:38:39 +00:00
<ToggleButton aria-label="Remember Me" />
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>