add typeahead aria labels to all Select boxes

This commit is contained in:
Keith J. Grant
2021-04-13 09:37:37 -07:00
parent f807b76044
commit 77cc3306a5
13 changed files with 20 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ function FieldWithPrompt({
</span> </span>
)} )}
</label> </label>
{tooltip && <Popover content={tooltip} id={fieldId} />} {tooltip && <Popover content={tooltip} id={`${fieldId}-tooltip`} />}
</div> </div>
<StyledCheckboxField <StyledCheckboxField
isDisabled={isDisabled} isDisabled={isDisabled}

View File

@@ -1,5 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { func, string } from 'prop-types'; import { func, string } from 'prop-types';
import { t } from '@lingui/macro';
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core'; import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
import { arrayToString, stringToArray } from '../../util/strings'; import { arrayToString, stringToArray } from '../../util/strings';
@@ -51,7 +52,7 @@ function TagMultiSelect({ onChange, value }) {
}} }}
selections={selections} selections={selections}
isOpen={isExpanded} isOpen={isExpanded}
aria-labelledby="tag-select" typeAheadAriaLabel={t`Select tags`}
> >
{renderOptions(options)} {renderOptions(options)}
</Select> </Select>

View File

@@ -175,6 +175,7 @@ function Search({
variant={SelectVariant.single} variant={SelectVariant.single}
className="simpleKeySelect" className="simpleKeySelect"
aria-label={i18n._(t`Simple key select`)} aria-label={i18n._(t`Simple key select`)}
typeAheadAriaLabel={i18n._(t`Simple key select`)}
onToggle={setIsSearchDropdownOpen} onToggle={setIsSearchDropdownOpen}
onSelect={handleDropdownSelect} onSelect={handleDropdownSelect}
selections={searchColumnName} selections={searchColumnName}
@@ -212,6 +213,7 @@ function Search({
<Select <Select
variant={SelectVariant.checkbox} variant={SelectVariant.checkbox}
aria-label={name} aria-label={name}
typeAheadAriaLabel={name}
onToggle={setIsFilterDropdownOpen} onToggle={setIsFilterDropdownOpen}
onSelect={(event, selection) => onSelect={(event, selection) =>
handleFilterDropdownSelect(key, event, selection) handleFilterDropdownSelect(key, event, selection)

View File

@@ -126,6 +126,7 @@ function ActivityStream({ i18n }) {
maxHeight="480px" maxHeight="480px"
variant={SelectVariant.single} variant={SelectVariant.single}
aria-labelledby="grouped-type-select-id" aria-labelledby="grouped-type-select-id"
typeAheadAriaLabel={t`Select an activity type`}
className="activityTypeSelect" className="activityTypeSelect"
onToggle={setIsTypeDropdownOpen} onToggle={setIsTypeDropdownOpen}
onSelect={(event, selection) => { onSelect={(event, selection) => {

View File

@@ -138,6 +138,7 @@ function CredentialFormFields({ i18n, initialTypeId, credentialTypes }) {
isDisabled={isCredentialTypeDisabled} isDisabled={isCredentialTypeDisabled}
ouiaId="CredentialForm-credential_type" ouiaId="CredentialForm-credential_type"
aria-label={i18n._(t`Credential Type`)} aria-label={i18n._(t`Credential Type`)}
typeAheadAriaLabel={i18n._(t`Select Credential Type`)}
isOpen={isSelectOpen} isOpen={isSelectOpen}
variant={SelectVariant.typeahead} variant={SelectVariant.typeahead}
onToggle={setIsSelectOpen} onToggle={setIsSelectOpen}
@@ -203,7 +204,7 @@ function CredentialFormFields({ i18n, initialTypeId, credentialTypes }) {
{isCredentialTypeDisabled ? ( {isCredentialTypeDisabled ? (
<Tooltip <Tooltip
content={i18n._( content={i18n._(
`You cannot change the credential type of a credential, `You cannot change the credential type of a credential,
as it may break the functionality of the resources using it.` as it may break the functionality of the resources using it.`
)} )}
> >

View File

@@ -43,6 +43,7 @@ function BecomeMethodField({ fieldOptions, isRequired }) {
> >
<Select <Select
ouiaId={`CredentialForm-${fieldOptions.id}`} ouiaId={`CredentialForm-${fieldOptions.id}`}
typeAheadAriaLabel={fieldOptions.label}
maxHeight={200} maxHeight={200}
variant={SelectVariant.typeahead} variant={SelectVariant.typeahead}
onToggle={setIsOpen} onToggle={setIsOpen}

View File

@@ -178,6 +178,7 @@ function Dashboard({ i18n }) {
variant={SelectVariant.single} variant={SelectVariant.single}
placeholderText={i18n._(t`Select period`)} placeholderText={i18n._(t`Select period`)}
aria-label={i18n._(t`Select period`)} aria-label={i18n._(t`Select period`)}
typeAheadAriaLabel={i18n._(t`Select period`)}
className="periodSelect" className="periodSelect"
onToggle={setIsPeriodDropdownOpen} onToggle={setIsPeriodDropdownOpen}
onSelect={(event, selection) => onSelect={(event, selection) =>

View File

@@ -125,6 +125,7 @@ const SCMSubForm = ({ autoPopulateProject, i18n }) => {
sourcePathHelpers.setValue(value); sourcePathHelpers.setValue(value);
}} }}
aria-label={i18n._(t`Select source path`)} aria-label={i18n._(t`Select source path`)}
typeAheadAriaLabel={i18n._(t`Select source path`)}
placeholder={i18n._(t`Select source path`)} placeholder={i18n._(t`Select source path`)}
createText={i18n._(t`Set source path to`)} createText={i18n._(t`Set source path to`)}
isCreatable isCreatable

View File

@@ -88,6 +88,7 @@ function SurveyPreviewModal({
id={`survey-preview-multipleChoice-${q.variable}`} id={`survey-preview-multipleChoice-${q.variable}`}
isDisabled isDisabled
aria-label={i18n._(t`Multiple Choice`)} aria-label={i18n._(t`Multiple Choice`)}
typeAheadAriaLabel={i18n._(t`Multiple Choice`)}
placeholderText={q.default} placeholderText={q.default}
onToggle={() => {}} onToggle={() => {}}
/> />
@@ -109,6 +110,7 @@ function SurveyPreviewModal({
} }
onToggle={() => {}} onToggle={() => {}}
aria-label={i18n._(t`Multi-Select`)} aria-label={i18n._(t`Multi-Select`)}
typeAheadAriaLabel={i18n._(t`Multi-Select`)}
id={`survey-preview-multiSelect-${q.variable}`} id={`survey-preview-multiSelect-${q.variable}`}
> >
{q.choices.length > 0 && {q.choices.length > 0 &&

View File

@@ -239,6 +239,7 @@ function NodeTypeStep({ i18n }) {
setIsConvergenceOpen(false); setIsConvergenceOpen(false);
}} }}
aria-label={i18n._(t`Convergence select`)} aria-label={i18n._(t`Convergence select`)}
typeAheadAriaLabel={i18n._(t`Convergence select`)}
className="convergenceSelect" className="convergenceSelect"
ouiaId="convergenceSelect" ouiaId="convergenceSelect"
> >

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { func, arrayOf, number, shape, string, oneOfType } from 'prop-types'; import { func, arrayOf, number, shape, string, oneOfType } from 'prop-types';
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core'; import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
import { t } from '@lingui/macro';
import { LabelsAPI } from '../../../api'; import { LabelsAPI } from '../../../api';
import { useSyncedSelectValue } from '../../../components/MultiSelect'; import { useSyncedSelectValue } from '../../../components/MultiSelect';
@@ -84,7 +85,7 @@ function LabelSelect({ value, placeholder, onChange, onError, createText }) {
isDisabled={isLoading} isDisabled={isLoading}
selections={selections} selections={selections}
isOpen={isExpanded} isOpen={isExpanded}
aria-labelledby="label-select" typeAheadAriaLabel={t`Select Labels`}
placeholderText={placeholder} placeholderText={placeholder}
createText={createText} createText={createText}
> >

View File

@@ -56,6 +56,7 @@ function PlaybookSelect({
selections={selected} selections={selected}
onToggle={setIsOpen} onToggle={setIsOpen}
placeholderText={i18n._(t`Select a playbook`)} placeholderText={i18n._(t`Select a playbook`)}
typeAheadAriaLabel={i18n._(t`Select a playbook`)}
isCreateable={false} isCreateable={false}
onSelect={(event, value) => { onSelect={(event, value) => {
setIsOpen(false); setIsOpen(false);

View File

@@ -159,7 +159,7 @@ function WorkflowJobTemplateForm({
)} )}
</> </>
<FieldWithPrompt <FieldWithPrompt
fieldId="wjft-limit" fieldId="wfjt-limit"
label={i18n._(t`Limit`)} label={i18n._(t`Limit`)}
promptId="template-ask-limit-on-launch" promptId="template-ask-limit-on-launch"
promptName="ask_limit_on_launch" promptName="ask_limit_on_launch"
@@ -169,7 +169,7 @@ function WorkflowJobTemplateForm({
documentation for more information and examples on patterns.`)} documentation for more information and examples on patterns.`)}
> >
<TextInput <TextInput
id="text-wfjt-limit" id="wfjt-limit"
{...limitField} {...limitField}
validated={ validated={
!limitMeta.touched || !limitMeta.error ? 'default' : 'error' !limitMeta.touched || !limitMeta.error ? 'default' : 'error'
@@ -190,7 +190,7 @@ function WorkflowJobTemplateForm({
)} )}
> >
<TextInput <TextInput
id="text-wfjt-scm-branch" id="wfjt-scm-branch"
{...scmField} {...scmField}
onChange={value => { onChange={value => {
scmHelpers.setValue(value); scmHelpers.setValue(value);