Skip to content

Commit

Permalink
Fixed a11y violations for Select examples (#1479)
Browse files Browse the repository at this point in the history
  • Loading branch information
r100-stack authored Aug 14, 2023
1 parent afd3111 commit eb088b0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
5 changes: 3 additions & 2 deletions examples/Select.disable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Select } from '@itwin/itwinui-react';
import { LabeledSelect } from '@itwin/itwinui-react';

export default () => {
return (
<Select<number>
<LabeledSelect
disabled
label={'Disabled Select Label'}
options={[
{
value: 1,
Expand Down
5 changes: 3 additions & 2 deletions examples/Select.icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { Select } from '@itwin/itwinui-react';
import { LabeledSelect } from '@itwin/itwinui-react';
import {
SvgSmileyHappy,
SvgSmileySad,
Expand All @@ -12,7 +12,8 @@ import {

export default () => {
return (
<Select
<LabeledSelect
label={'Choose feeling'}
options={[
{
value: 'happy',
Expand Down
5 changes: 3 additions & 2 deletions examples/Select.statuses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { MenuItem, Select } from '@itwin/itwinui-react';
import { MenuItem, LabeledSelect } from '@itwin/itwinui-react';

export default () => {
const options = [
Expand All @@ -22,7 +22,8 @@ export default () => {
];

return (
<Select<string>
<LabeledSelect
label={'Choose color'}
options={options}
placeholder={'Placeholder text'}
itemRenderer={(option) => (
Expand Down
9 changes: 8 additions & 1 deletion examples/Select.sublabels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export default () => {
];

return (
<Select options={options} placeholder={'Placeholder text'} size={'large'} />
<Select
triggerProps={{
'aria-label': 'Select label',
}}
options={options}
placeholder={'Placeholder text'}
size={'large'}
/>
);
};
9 changes: 7 additions & 2 deletions examples/Select.truncate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { MenuItem, MiddleTextTruncation, Select } from '@itwin/itwinui-react';
import {
MenuItem,
MiddleTextTruncation,
LabeledSelect,
} from '@itwin/itwinui-react';
import { useCallback, useState } from 'react';

export default () => {
Expand Down Expand Up @@ -35,7 +39,8 @@ export default () => {
[],
);
return (
<Select
<LabeledSelect
label={'Choose file'}
options={options}
value={selectedValue}
onChange={setSelectedValue}
Expand Down

0 comments on commit eb088b0

Please sign in to comment.