Chore: Low hanging a11y fruits (#37783)
* aria-label disallowed on header element * A11y issues for Getting Started and panel header * Add unique identifier to search navigation * Add dashboard header markup * Fix news panel low hanging fruits
This commit is contained in:
@@ -44,7 +44,7 @@ export const Components = {
|
|||||||
},
|
},
|
||||||
Panels: {
|
Panels: {
|
||||||
Panel: {
|
Panel: {
|
||||||
title: (title: string) => `Panel header ${title}`,
|
title: (title: string) => `data-testid Panel header ${title}`,
|
||||||
headerItems: (item: string) => `Panel header item ${item}`,
|
headerItems: (item: string) => `Panel header item ${item}`,
|
||||||
containerByTitle: (title: string) => `${title} panel`,
|
containerByTitle: (title: string) => `${title} panel`,
|
||||||
headerCornerInfo: (mode: string) => `Panel header ${mode}`,
|
headerCornerInfo: (mode: string) => `Panel header ${mode}`,
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const PageToolbar: FC<Props> = React.memo(
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<nav className={styles.navElement}>
|
<nav aria-label="Search links" className={styles.navElement}>
|
||||||
{parent && parentHref && (
|
{parent && parentHref && (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const PanelHeader: FC<Props> = ({ panel, error, isViewing, isEditing, dat
|
|||||||
error={error}
|
error={error}
|
||||||
/>
|
/>
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<PanelHeaderMenuTrigger aria-label={selectors.components.Panels.Panel.title(title)}>
|
<PanelHeaderMenuTrigger data-testid={selectors.components.Panels.Panel.title(title)}>
|
||||||
{({ closeMenu, panelMenuOpen }) => {
|
{({ closeMenu, panelMenuOpen }) => {
|
||||||
return (
|
return (
|
||||||
<div className="panel-title">
|
<div className="panel-title">
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ export class PanelHeaderCorner extends Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip content={content} placement="top-start" theme={theme}>
|
<Tooltip content={content} placement="top-start" theme={theme}>
|
||||||
<div className={className} onClick={onClick} aria-label={ariaLabel}>
|
<section className={className} onClick={onClick} aria-label={ariaLabel}>
|
||||||
<i className="fa" />
|
<i aria-hidden className="fa" />
|
||||||
<span className="panel-info-corner-inner" />
|
<span className="panel-info-corner-inner" />
|
||||||
</div>
|
</section>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export class GettingStarted extends PureComponent<PanelProps, State> {
|
|||||||
</div>
|
</div>
|
||||||
{currentStep === steps.length - 1 && (
|
{currentStep === steps.length - 1 && (
|
||||||
<div className={cx(styles.backForwardButtons, styles.previous)} onClick={this.onPreviousClick}>
|
<div className={cx(styles.backForwardButtons, styles.previous)} onClick={this.onPreviousClick}>
|
||||||
<Button icon="angle-left" variant="secondary" />
|
<Button aria-label="To advanced tutorials" icon="angle-left" variant="secondary" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
@@ -107,7 +107,7 @@ export class GettingStarted extends PureComponent<PanelProps, State> {
|
|||||||
</div>
|
</div>
|
||||||
{currentStep < steps.length - 1 && (
|
{currentStep < steps.length - 1 && (
|
||||||
<div className={cx(styles.backForwardButtons, styles.forward)} onClick={this.onForwardClick}>
|
<div className={cx(styles.backForwardButtons, styles.forward)} onClick={this.onForwardClick}>
|
||||||
<Button icon="angle-right" variant="secondary" />
|
<Button aria-label="To basic tutorials" icon="angle-right" variant="secondary" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const DocsCard: FC<Props> = ({ card }) => {
|
|||||||
return (
|
return (
|
||||||
<div className={styles.card}>
|
<div className={styles.card}>
|
||||||
<div className={cardContent}>
|
<div className={cardContent}>
|
||||||
<a href={`${card.href}?utm_source=grafana_gettingstarted`}>
|
<a href={`${card.href}?utm_source=grafana_gettingstarted`} className={styles.url}>
|
||||||
<div className={styles.heading}>{card.done ? 'complete' : card.heading}</div>
|
<div className={styles.heading}>{card.done ? 'complete' : card.heading}</div>
|
||||||
<h4 className={styles.title}>{card.title}</h4>
|
<h4 className={styles.title}>{card.title}</h4>
|
||||||
<div>
|
<div>
|
||||||
@@ -26,7 +26,7 @@ export const DocsCard: FC<Props> = ({ card }) => {
|
|||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
href={`${card.learnHref}?utm_source=grafana_gettingstarted`}
|
href={`${card.learnHref}?utm_source=grafana_gettingstarted`}
|
||||||
className={styles.url}
|
className={styles.learnUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
@@ -56,6 +56,9 @@ const getStyles = stylesFactory((theme: GrafanaTheme, complete: boolean) => {
|
|||||||
margin-bottom: ${theme.spacing.md};
|
margin-bottom: ${theme.spacing.md};
|
||||||
`,
|
`,
|
||||||
url: css`
|
url: css`
|
||||||
|
display: inline-block;
|
||||||
|
`,
|
||||||
|
learnUrl: css`
|
||||||
border-top: 1px solid ${theme.colors.border1};
|
border-top: 1px solid ${theme.colors.border1};
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ export class NewsPanel extends PureComponent<Props, State> {
|
|||||||
<article key={index} className={cx(styles.item, useWideLayout && styles.itemWide)}>
|
<article key={index} className={cx(styles.item, useWideLayout && styles.itemWide)}>
|
||||||
{showImage && item.ogImage && (
|
{showImage && item.ogImage && (
|
||||||
<a
|
<a
|
||||||
|
tabIndex={-1}
|
||||||
href={textUtil.sanitizeUrl(item.link)}
|
href={textUtil.sanitizeUrl(item.link)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
@@ -152,6 +153,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => ({
|
|||||||
`,
|
`,
|
||||||
link: css`
|
link: css`
|
||||||
color: ${theme.colors.text.link};
|
color: ${theme.colors.text.link};
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: ${theme.colors.text.link};
|
color: ${theme.colors.text.link};
|
||||||
|
|||||||
Reference in New Issue
Block a user