From 7a2a5dde8b095e6e3ae0a6f16bdef5309fcf3403 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 30 Jun 2023 16:58:16 +0100 Subject: [PATCH] Chore: Enable remaining jsx-a11y rules (#70990) enabling remaining a11y rules + ignore existing violations --- .eslintrc | 6 ++---- .../grafana-ui/src/components/Select/SelectOptionGroup.tsx | 2 ++ packages/grafana-ui/src/components/Table/FilterPopup.tsx | 2 +- packages/grafana-ui/src/components/Tooltip/Popover.tsx | 2 ++ public/app/core/components/Layers/LayerDragDropList.tsx | 2 ++ public/app/core/components/OptionsUI/color.tsx | 4 ++++ .../app/core/components/RolePicker/RoleMenuGroupOption.tsx | 2 ++ public/app/core/components/RolePicker/RoleMenuOption.tsx | 2 ++ public/app/core/components/RolePicker/RolePickerInput.tsx | 2 ++ .../rule-editor/notificaton-preview/NotificationRoute.tsx | 2 ++ public/app/features/canvas/runtime/ables.tsx | 2 ++ public/app/features/canvas/runtime/element.tsx | 2 ++ .../dashgrid/PanelHeader/PanelHeaderLoadingIndicator.tsx | 4 ++++ .../dashgrid/PanelHeader/PanelHeaderMenuTrigger.tsx | 2 ++ .../datasources/components/picker/DataSourceDropdown.tsx | 2 ++ public/app/features/dimensions/editors/ResourceCards.tsx | 2 ++ public/app/features/dimensions/editors/ResourcePicker.tsx | 2 ++ .../components/TracePageHeader/NewTracePageSearchBar.tsx | 2 ++ .../components/TraceTimelineViewer/SpanDetail/index.tsx | 2 ++ public/app/features/logs/components/LogRowMessage.tsx | 4 ++++ .../panel/components/VizTypePicker/PanelTypeCard.tsx | 2 ++ .../app/features/search/page/components/FolderSection.tsx | 2 ++ public/app/features/search/page/components/columns.tsx | 4 ++++ public/app/features/storage/Breadcrumb.tsx | 2 ++ .../azuremonitor/components/TracesQueryEditor/Filter.tsx | 2 ++ .../prometheus/querybuilder/components/MetricSelect.tsx | 2 ++ .../app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx | 2 ++ public/app/plugins/panel/xychart/ManualEditor.tsx | 2 ++ 28 files changed, 63 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index 961434913e5..b3018967038 100644 --- a/.eslintrc +++ b/.eslintrc @@ -74,20 +74,18 @@ }, { "extends": ["plugin:jsx-a11y/recommended"], - "files": ["**/*"], - "excludedFiles": ["**/*.{spec,test}.{ts,tsx}"], + "files": ["**/*.tsx"], + "excludedFiles": ["**/*.{spec,test}.tsx"], "rules": { // rules marked "off" are those left in the recommended preset we need to fix // we should remove the corresponding line and fix them one by one // any marked "error" contain specific overrides we'll need to keep - "jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/no-autofocus": [ "error", { "ignoreNonDOM": true } ], - "jsx-a11y/no-static-element-interactions": "off", "jsx-a11y/label-has-associated-control": [ "error", { diff --git a/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx b/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx index 5b91d3659c4..b5c787cc219 100644 --- a/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx +++ b/packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx @@ -81,6 +81,8 @@ class UnthemedSelectOptionGroup extends PureComponent return (
+ {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
{label} {' '} diff --git a/packages/grafana-ui/src/components/Table/FilterPopup.tsx b/packages/grafana-ui/src/components/Table/FilterPopup.tsx index 0f8a5b40db3..a8cd51ced95 100644 --- a/packages/grafana-ui/src/components/Table/FilterPopup.tsx +++ b/packages/grafana-ui/src/components/Table/FilterPopup.tsx @@ -51,7 +51,7 @@ export const FilterPopup = ({ column: { preFilteredRows, filterValue, setFilter return ( {/* This is just blocking click events from bubbeling and should not have a keyboard interaction. */} - {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */} + {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}
diff --git a/packages/grafana-ui/src/components/Tooltip/Popover.tsx b/packages/grafana-ui/src/components/Tooltip/Popover.tsx index e0b2939eb87..fa9b3d3d643 100644 --- a/packages/grafana-ui/src/components/Tooltip/Popover.tsx +++ b/packages/grafana-ui/src/components/Tooltip/Popover.tsx @@ -66,6 +66,8 @@ class Popover extends PureComponent { > {({ ref, style, placement, arrowProps, update }) => { return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/no-static-element-interactions
({ rows.push( {(provided, snapshot) => ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/no-static-element-interactions
{value ? ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions {value} ) : ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions {settings?.placeholder ?? 'Select color'} diff --git a/public/app/core/components/RolePicker/RoleMenuGroupOption.tsx b/public/app/core/components/RolePicker/RoleMenuGroupOption.tsx index e64647fac27..6a7a1fef7cd 100644 --- a/public/app/core/components/RolePicker/RoleMenuGroupOption.tsx +++ b/public/app/core/components/RolePicker/RoleMenuGroupOption.tsx @@ -81,6 +81,8 @@ export const RoleMenuGroupOption = memo( return (
+ {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
{showBasicRole && {basicRole}} diff --git a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx index de5ee4e12b2..1a7f9a13944 100644 --- a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx @@ -53,6 +53,8 @@ function NotificationRouteHeader({ /> + {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
onExpandRouteClick(!expandRoute)} className={styles.expandable}> Notification policy diff --git a/public/app/features/canvas/runtime/ables.tsx b/public/app/features/canvas/runtime/ables.tsx index 41820406ae7..42504175971 100644 --- a/public/app/features/canvas/runtime/ables.tsx +++ b/public/app/features/canvas/runtime/ables.tsx @@ -16,6 +16,8 @@ export const settingsViewable = (scene: Scene) => ({ const rect = moveable.getRect(); return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
{ if (state === LoadingState.Loading) { return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -24,6 +26,8 @@ export const PanelHeaderLoadingIndicator = ({ state, onClick }: Props) => { if (state === LoadingState.Streaming) { return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuTrigger.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuTrigger.tsx index daf3666ef03..881d3f9f2a6 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuTrigger.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuTrigger.tsx @@ -35,6 +35,8 @@ export function PanelHeaderMenuTrigger({ children, onOpenMenu, ...divProps }: Pr }, []); return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
{children({ panelMenuOpen, closeMenu: () => setPanelMenuOpen(false) })}
diff --git a/public/app/features/datasources/components/picker/DataSourceDropdown.tsx b/public/app/features/datasources/components/picker/DataSourceDropdown.tsx index 95dec73300c..cef3c26eece 100644 --- a/public/app/features/datasources/components/picker/DataSourceDropdown.tsx +++ b/public/app/features/datasources/components/picker/DataSourceDropdown.tsx @@ -183,6 +183,8 @@ export function DataSourceDropdown(props: DataSourceDropdownProps) { {isOpen ? (
+ {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
{card && ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
{ /> )} + {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
{size === ResourcePickerSize.SMALL && renderSmallResourcePicker()} {size === ResourcePickerSize.NORMAL && renderNormalResourcePicker()} diff --git a/public/app/features/explore/TraceView/components/TracePageHeader/NewTracePageSearchBar.tsx b/public/app/features/explore/TraceView/components/TracePageHeader/NewTracePageSearchBar.tsx index 52850771d19..886b22910f8 100644 --- a/public/app/features/explore/TraceView/components/TracePageHeader/NewTracePageSearchBar.tsx +++ b/public/app/features/explore/TraceView/components/TracePageHeader/NewTracePageSearchBar.tsx @@ -147,6 +147,8 @@ export default memo(function NewTracePageSearchBar(props: TracePageSearchBarProp onChange={(value) => setShowSpanFilterMatchesOnly(value.currentTarget.checked ?? false)} label="Show matches only switch" /> + {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} setShowSpanFilterMatchesOnly(!showSpanFilterMatchesOnly)}>Show matches only
diff --git a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx index ae0be3b79ed..27c6686f242 100644 --- a/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx +++ b/public/app/features/explore/TraceView/components/TraceTimelineViewer/SpanDetail/index.tsx @@ -383,6 +383,8 @@ export default function SpanDetail(props: SpanDetailProps) { )} {topOfViewRefType === TopOfViewRefType.Explore && ( + {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} { diff --git a/public/app/features/logs/components/LogRowMessage.tsx b/public/app/features/logs/components/LogRowMessage.tsx index 411800609dd..95bbe28d380 100644 --- a/public/app/features/logs/components/LogRowMessage.tsx +++ b/public/app/features/logs/components/LogRowMessage.tsx @@ -115,6 +115,8 @@ export class LogRowMessage extends PureComponent { {pinned && ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions { /> )} + {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} {shouldShowContextToggle && ( {selectionToggle && selection && ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
Score
, Cell: (p) => { return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
{ diff --git a/public/app/features/storage/Breadcrumb.tsx b/public/app/features/storage/Breadcrumb.tsx index 4ea7f9c3218..e3ff0a84809 100644 --- a/public/app/features/storage/Breadcrumb.tsx +++ b/public/app/features/storage/Breadcrumb.tsx @@ -27,6 +27,8 @@ export function Breadcrumb({ pathName, onPathChange, rootIcon }: Props) { const onClickBreadcrumb = () => onPathChange(url); const isLastBreadcrumb = index === paths.length - 1; return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events
  • {path}
  • diff --git a/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/Filter.tsx b/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/Filter.tsx index 7ec0f9f428b..73bb0613167 100644 --- a/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/Filter.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/TracesQueryEditor/Filter.tsx @@ -155,6 +155,8 @@ const Option = (props: React.PropsWithChildren) => { }; return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
    + {/* TODO: fix keyboard a11y */} + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
    { diff --git a/public/app/plugins/panel/xychart/ManualEditor.tsx b/public/app/plugins/panel/xychart/ManualEditor.tsx index 93c772b5625..de00a9acbbb 100644 --- a/public/app/plugins/panel/xychart/ManualEditor.tsx +++ b/public/app/plugins/panel/xychart/ManualEditor.tsx @@ -66,6 +66,8 @@ export const ManualEditor = ({
    {value.map((series, index) => { return ( + // TODO: fix keyboard a11y + // eslint-disable-next-line jsx-a11y/no-static-element-interactions
    setSelected(index)}>