Skip to content

Commit

Permalink
Add aria-live message to FilterList
Browse files Browse the repository at this point in the history
sergiou87 committed May 25, 2023
1 parent e2a7000 commit b619016
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/ui/lib/filter-list.tsx
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import { TextBox } from '../lib/text-box'
import { Row } from '../lib/row'

import { match, IMatch, IMatches } from '../../lib/fuzzy-find'
import { AriaLiveContainer } from '../accessibility/aria-live-container'

/** An item in the filter list. */
export interface IFilterListItem {
@@ -288,8 +289,14 @@ export class FilterList<T extends IFilterListItem> extends React.Component<
}

public render() {
const itemRows = this.state.rows.filter(row => row.kind === 'item')
const resultsPluralized = itemRows.length === 1 ? 'result' : 'results'

return (
<div className={classnames('filter-list', this.props.className)}>
<AriaLiveContainer>
{itemRows.length} {resultsPluralized}
</AriaLiveContainer>
{this.props.renderPreList ? this.props.renderPreList() : null}

{this.renderFilterRow()}

0 comments on commit b619016

Please sign in to comment.