Skip to content

Commit

Permalink
[DOCS] Added a11y guidance for EuiTooltip and EuiPopover (#7527)
Browse files Browse the repository at this point in the history
  • Loading branch information
1Copenut authored Feb 14, 2024
1 parent 13a1314 commit 6468ebd
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 23 deletions.
35 changes: 30 additions & 5 deletions src-docs/src/views/popover/popover_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EuiPopoverTitle,
EuiPopoverFooter,
EuiCallOut,
EuiText,
} from '../../../../src/components';

import { EuiPopoverPanelProps } from './props';
Expand Down Expand Up @@ -157,6 +158,35 @@ const inputPopoverSnippet = `<EuiInputPopover

export const PopoverExample = {
title: 'Popover',
intro: (
<EuiText>
<p>
Use the <strong>EuiPopover</strong> component to hide controls or
options behind a clickable element. A popover is temporary so keep tasks
simple and narrowly focused.
</p>

<EuiCallOut
iconType="accessibility"
color="warning"
title="Popovers have three accessibility requirements:"
>
<>
<ul>
<li>
Popover triggers <strong>must</strong> be anchored to elements
that accept keyboard focus.
</li>
<li>
Popovers can contain interactive elements. They{' '}
<strong>must</strong> be controlled by a click handler.
</li>
<li>Popovers must not be activated by hover or focus events.</li>
</ul>
</>
</EuiCallOut>
</EuiText>
),
sections: [
{
source: [
Expand All @@ -167,11 +197,6 @@ export const PopoverExample = {
],
text: (
<>
<p>
Use the <strong>EuiPopover</strong> component to hide controls or
options behind a clickable element. A popover is temporary so keep
tasks simple and narrowly focused.
</p>
<p>
While the visibility of the popover is maintained by the consuming
application, popovers will automatically close when clicking outside
Expand Down
38 changes: 20 additions & 18 deletions src-docs/src/views/tool_tip/tool_tip_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,26 @@ export const ToolTipExample = {
<EuiCallOut
iconType="accessibility"
color="warning"
title={
<>
Putting anything other than plain text in a tooltip is lost on
screen readers.
</>
}
/>
title="Tooltips have three accessibilty requirements:"
>
<>
<ul>
<li>
Tooltips <strong>must</strong> be anchored to elements that accept
keyboard focus.
</li>
<li>
Put only plain text in tooltips so the content is accessible to
keyboard and screen reader users.
</li>
<li>
{' '}
Do not add links, buttons, or other interactive content inside
tooltips.
</li>
</ul>
</>
</EuiCallOut>
</EuiText>
),
sections: [
Expand All @@ -87,17 +100,6 @@ export const ToolTipExample = {
will change it if the tooltip gets too close to the edge of the
screen.
</p>

<EuiCallOut
iconType="accessibility"
color="warning"
title={
<>
Anchoring a tooltip to a non-interactive element makes it
difficult for keyboard-only and screen reader users to read.
</>
}
/>
</>
),
source: [
Expand Down

0 comments on commit 6468ebd

Please sign in to comment.