From 8505a8c57f8c84f7001be1dc4389df7742b99f87 Mon Sep 17 00:00:00 2001 From: ngorin Date: Thu, 8 Feb 2024 16:10:09 +0300 Subject: [PATCH 1/3] chore: enable a11y eslint rules --- .eslintrc | 3 ++- src/components/PostInfo/components/Save.tsx | 3 +++ src/components/Search/Search.tsx | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9b947813..85d65103 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,7 +2,8 @@ "extends": [ "@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier", - "@gravity-ui/eslint-config/client" + "@gravity-ui/eslint-config/client", + "@gravity-ui/eslint-config/a11y" ], "root": true, "env": { diff --git a/src/components/PostInfo/components/Save.tsx b/src/components/PostInfo/components/Save.tsx index 4b7de9cd..520ff4ef 100644 --- a/src/components/PostInfo/components/Save.tsx +++ b/src/components/PostInfo/components/Save.tsx @@ -1,3 +1,4 @@ +/* eslint-disable jsx-a11y/click-events-have-key-events */ import React, {useContext} from 'react'; import {useAnalytics} from '@gravity-ui/page-constructor'; @@ -59,6 +60,8 @@ export const Save = ({ return (
{ // both preventDefault and stopImmediatePropagation required to work properly diff --git a/src/components/Search/Search.tsx b/src/components/Search/Search.tsx index f596edd8..35c4ce6c 100644 --- a/src/components/Search/Search.tsx +++ b/src/components/Search/Search.tsx @@ -78,7 +78,8 @@ export const Search = ({ }; return ( -
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events +
); From 43784cbf1101afa76836d42ef5d84c1e940d3c4f Mon Sep 17 00:00:00 2001 From: ngorin Date: Mon, 12 Feb 2024 15:36:32 +0300 Subject: [PATCH 2/3] feat: change div on button tag in Save and Search --- src/components/PostInfo/PostInfo.scss | 9 +++++++++ src/components/PostInfo/components/Save.tsx | 8 +++----- src/components/Search/Search.scss | 3 +++ src/components/Search/Search.tsx | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/PostInfo/PostInfo.scss b/src/components/PostInfo/PostInfo.scss index b7fed26a..1c8b1efe 100644 --- a/src/components/PostInfo/PostInfo.scss +++ b/src/components/PostInfo/PostInfo.scss @@ -22,6 +22,15 @@ $block: '.#{$namespace}post-info'; @include text-size(body-3); } } + + &_save { + background: none; + color: inherit; + border: none; + padding: 0; + font: inherit; + cursor: pointer; + } } &__item:last-child { diff --git a/src/components/PostInfo/components/Save.tsx b/src/components/PostInfo/components/Save.tsx index 520ff4ef..0b12444e 100644 --- a/src/components/PostInfo/components/Save.tsx +++ b/src/components/PostInfo/components/Save.tsx @@ -59,10 +59,8 @@ export const Save = ({ const isLikeable = Boolean(toggleLike); return ( -
{ // both preventDefault and stopImmediatePropagation required to work properly // https://stackoverflow.com/questions/24415631/reactjs-syntheticevent-stoppropagation-only-works-with-react-events @@ -96,6 +94,6 @@ export const Save = ({ {title}
-
+ ); }; diff --git a/src/components/Search/Search.scss b/src/components/Search/Search.scss index e89b2636..2e15cf06 100644 --- a/src/components/Search/Search.scss +++ b/src/components/Search/Search.scss @@ -19,6 +19,9 @@ $block: '.#{$namespace}search'; &__input-icon { display: flex; padding-right: 7px; + border: none; + font: inherit; + background: none; color: var(--g-color-text-hint); cursor: pointer; } diff --git a/src/components/Search/Search.tsx b/src/components/Search/Search.tsx index 35c4ce6c..696677b6 100644 --- a/src/components/Search/Search.tsx +++ b/src/components/Search/Search.tsx @@ -79,9 +79,9 @@ export const Search = ({ return ( // eslint-disable-next-line jsx-a11y/click-events-have-key-events -
+
+ ); }, [handleChange, onSubmit, value]); From 7c69cd0308a168bc00a3b9be6c3cb9a1837e6eb0 Mon Sep 17 00:00:00 2001 From: ngorin Date: Thu, 15 Feb 2024 11:32:26 +0300 Subject: [PATCH 3/3] feat: del eslint ignore comments --- src/components/PostInfo/components/Save.tsx | 1 - src/components/Search/Search.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/components/PostInfo/components/Save.tsx b/src/components/PostInfo/components/Save.tsx index 0b12444e..3ee625f7 100644 --- a/src/components/PostInfo/components/Save.tsx +++ b/src/components/PostInfo/components/Save.tsx @@ -1,4 +1,3 @@ -/* eslint-disable jsx-a11y/click-events-have-key-events */ import React, {useContext} from 'react'; import {useAnalytics} from '@gravity-ui/page-constructor'; diff --git a/src/components/Search/Search.tsx b/src/components/Search/Search.tsx index 696677b6..6f1c3b34 100644 --- a/src/components/Search/Search.tsx +++ b/src/components/Search/Search.tsx @@ -78,7 +78,6 @@ export const Search = ({ }; return ( - // eslint-disable-next-line jsx-a11y/click-events-have-key-events