fix: remove aria-live region for autosuggest (#1520)

This commit is contained in:
Nolan Lawson 2019-09-22 23:53:09 -07:00 committed by GitHub
parent 3338159eaa
commit 8f3b0ac80a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,9 +8,6 @@
selected={autosuggestSelected}
{realm}
/>
<div class="sr-only" aria-live="assertive">
{assertiveAriaText}
</div>
</div>
<style>
.compose-autosuggest {
@ -57,7 +54,6 @@
import { selectAutosuggestItem } from '../../_actions/autosuggest'
import { observe } from 'svelte-extras'
import { once } from '../../_utils/once'
import { createAutosuggestAccessibleLabel } from '../../_utils/createAutosuggestAccessibleLabel'
export default {
oncreate () {
@ -111,21 +107,7 @@
/* eslint-enable camelcase */
shouldBeShown: ({ realm, $autosuggestShown, composeFocused }) => (
!!($autosuggestShown && composeFocused)
),
// text that is read to screen readers. based on https://haltersweb.github.io/Accessibility/autocomplete.html
assertiveAriaText: ({
shouldBeShown,
autosuggestSearchResults,
autosuggestSelected,
autosuggestType,
$omitEmojiInDisplayNames
}) => {
if (!shouldBeShown || !autosuggestSearchResults || !autosuggestSearchResults.length) {
return ''
}
return createAutosuggestAccessibleLabel(autosuggestType, $omitEmojiInDisplayNames,
autosuggestSelected, autosuggestSearchResults)
}
)
},
data: () => ({
shown: false