Skip to content

Commit 48db43e

Browse files
authored
feat: aria-invalid on Select components (#1233)
* feat: aria-invalid on input in select components when variant=error * chore: 11.0.5
1 parent 774e522 commit 48db43e

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@equinor/amplify-component-lib",
3-
"version": "11.0.4",
3+
"version": "11.0.5",
44
"description": "Frontend Typescript components for the Amplify team",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/molecules/Select/SearchBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export const SearchBar = <T extends SelectOptionRequired>({
171171
autoComplete="off"
172172
onChange={handleOnSearchChange}
173173
onKeyDownCapture={handleOnSearchKeyDown}
174+
aria-invalid={variant === 'error' ? true : undefined}
174175
/>
175176
{loading && (
176177
<SkeletonField

src/molecules/Select/SingleSelect/SingleSelect.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,23 @@ export const TestDirtyVariant: Story = {
286286
},
287287
};
288288

289+
export const TestErrorVariant: Story = {
290+
tags: ['test-only'],
291+
args: {
292+
items: FAKE_ITEMS,
293+
value: undefined,
294+
variant: 'error',
295+
helperText: 'This is the helper text',
296+
onSelect: fn(),
297+
},
298+
play: async ({ canvas }) => {
299+
await expect(canvas.getByRole('combobox')).toHaveAttribute(
300+
'aria-invalid',
301+
'true'
302+
);
303+
},
304+
};
305+
289306
export const TestRendersPlaceholder: Story = {
290307
tags: ['test-only'],
291308
args: {

0 commit comments

Comments
 (0)