From 6db09974d6b320bcebe8bd462cf1d7d677b19ea5 Mon Sep 17 00:00:00 2001 From: Elmar <102954831+elmar-vega@users.noreply.github.com> Date: Thu, 7 Jul 2022 12:01:03 +0100 Subject: [PATCH] Feat/621 a11y storybook add on (#705) * chore(ui-toolkit): add aria label to icon for a11y (#621) * chore(ui-toolkit): add labels for form-groups for a11y (#621) * fix(ui-toolkit): fix form inputs storybook for a11y (#621) * feat(ui-toolkit): add strict eslint a11y and components config (#621) * chore(ui-toolkit): add translate t to form labels --- .eslintrc.json | 12 +++++ .../src/app/components/search/search.tsx | 8 ++- .../components/token-input/token-input.tsx | 7 ++- .../token/src/routes/staking/staking-form.tsx | 7 ++- apps/trading/components/navbar/navbar.tsx | 2 + .../withdraw/withdraw-page-container.tsx | 3 +- .../components/deal-ticket-limit-amount.tsx | 11 +++- .../components/deal-ticket-market-amount.tsx | 4 +- .../src/components/expiry-selector.tsx | 3 +- .../src/components/side-selector.tsx | 4 +- .../src/components/time-in-force-selector.tsx | 4 +- .../src/components/type-selector.tsx | 4 +- libs/deposits/src/lib/deposit-form.tsx | 4 +- .../components/landing/select-market-list.tsx | 11 +++- libs/ui-toolkit/.storybook/preview.js | 16 ++++++ .../src/components/form-group/form-group.tsx | 42 +++++++++------- libs/ui-toolkit/src/components/icon/icon.tsx | 11 +++- .../src/components/input/input.stories.tsx | 50 +++++++++++++------ .../components/radio-group/radio-group.tsx | 4 +- .../src/components/select/select.stories.tsx | 19 ++++--- .../text-area/text-area.stories.tsx | 15 ++++-- .../src/components/toggle/toggle.tsx | 5 +- libs/wallet/src/provider.spec.tsx | 1 + libs/wallet/src/rest-connector-form.tsx | 1 - 24 files changed, 184 insertions(+), 64 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 20df314eb..e443df6d4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,9 +2,21 @@ "root": true, "ignorePatterns": ["**/*"], "plugins": ["@nrwl/nx", "eslint-plugin-unicorn", "jsx-a11y", "jest"], + "settings": { + "jsx-a11y": { + "components": { + "Button": "button", + "Input": "input", + "Select": "select", + "Radio": "radio", + "TextArea": "textarea" + } + } + }, "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "extends": ["plugin:jsx-a11y/strict"], "rules": { "@nrwl/nx/enforce-module-boundaries": [ "error", diff --git a/apps/explorer/src/app/components/search/search.tsx b/apps/explorer/src/app/components/search/search.tsx index ea4e9e932..437fd4d71 100644 --- a/apps/explorer/src/app/components/search/search.tsx +++ b/apps/explorer/src/app/components/search/search.tsx @@ -55,14 +55,18 @@ export const Search = () => { onSubmit={handleSubmit(onSubmit)} className="flex-1 flex self-center md:ml-16 md:mr-12 md:justify-end" > - + {error?.message && ( diff --git a/apps/token/src/components/token-input/token-input.tsx b/apps/token/src/components/token-input/token-input.tsx index 4d583bead..3e0ebd10b 100644 --- a/apps/token/src/components/token-input/token-input.tsx +++ b/apps/token/src/components/token-input/token-input.tsx @@ -6,6 +6,7 @@ import { FormGroup, Lozenge, } from '@vegaprotocol/ui-toolkit'; +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { useTranslation } from 'react-i18next'; @@ -174,7 +175,11 @@ export const TokenInput = ({ return ( <> - +

{t('Manage your stake')}

- + { // @ts-ignore value does exist on target setAction(value); diff --git a/apps/trading/components/navbar/navbar.tsx b/apps/trading/components/navbar/navbar.tsx index 801f5ac8b..2d6dc26c9 100644 --- a/apps/trading/components/navbar/navbar.tsx +++ b/apps/trading/components/navbar/navbar.tsx @@ -8,6 +8,7 @@ export const Navbar = () => { return (