Skip to content

Commit

Permalink
[v9.3.x] Accessibility: Improve keyboard accessibility in `AnnoListPa…
Browse files Browse the repository at this point in the history
…nel` (grafana#59015)

Accessibility: Improve keyboard accessibility in `AnnoListPanel` (grafana#58971)

fix keyboard accessibility in AnnoListPanel

(cherry picked from commit 598935c)

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
  • Loading branch information
2 people authored and GuaYounesPW committed Feb 8, 2023
1 parent 051bdff commit 22b4976
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions public/app/plugins/panel/annolist/AnnoListPanel.tsx
@@ -1,5 +1,4 @@
import { css } from '@emotion/css';
import { FocusScope } from '@react-aria/focus';
import React, { PureComponent } from 'react';
import { Subscription } from 'rxjs';

Expand All @@ -14,7 +13,7 @@ import {
PanelProps,
} from '@grafana/data';
import { config, getBackendSrv, locationService } from '@grafana/runtime';
import { CustomScrollbar, stylesFactory, TagList } from '@grafana/ui';
import { Button, CustomScrollbar, stylesFactory, TagList } from '@grafana/ui';
import { AbstractList } from '@grafana/ui/src/components/List/AbstractList';
import appEvents from 'app/core/app_events';
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
Expand Down Expand Up @@ -263,21 +262,25 @@ export class AnnoListPanel extends PureComponent<Props, State> {
<div className={this.style.filter}>
<b>Filter:</b>
{queryUser && (
<span onClick={this.onClearUser} className="pointer">
<Button
size="sm"
variant="secondary"
fill="text"
onClick={this.onClearUser}
aria-label={`Remove filter: ${queryUser.email}`}
>
{queryUser.email}
</span>
</Button>
)}
{queryTags.length > 0 && (
<FocusScope restoreFocus>
<TagList
icon="times"
tags={queryTags}
onClick={(tag) => this.onTagClick(tag, true)}
getAriaLabel={(name) => `Remove ${name} tag`}
className={this.style.tagList}
ref={this.tagListRef}
/>
</FocusScope>
<TagList
icon="times"
tags={queryTags}
onClick={(tag) => this.onTagClick(tag, true)}
getAriaLabel={(name) => `Remove ${name} tag`}
className={this.style.tagList}
ref={this.tagListRef}
/>
)}
</div>
)}
Expand All @@ -299,11 +302,11 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => ({
height: calc(100% - 30px);
`,
filter: css({
alignItems: 'center',
display: 'flex',
padding: `0px ${theme.spacing(0.5)}`,
b: {
paddingRight: theme.spacing(1),
},
flexWrap: 'wrap',
gap: theme.spacing(0.5),
padding: theme.spacing(0.5),
}),
tagList: css({
justifyContent: 'flex-start',
Expand Down

0 comments on commit 22b4976

Please sign in to comment.