Skip to content

Commit

Permalink
Revert "[Docs] Adding more acccessibility-focused notes and examples (e…
Browse files Browse the repository at this point in the history
…lastic#3714)"

This reverts commit c7666f5.
  • Loading branch information
anishagg17 authored Jul 20, 2020
1 parent cc8585a commit bacd494
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 126 deletions.
1 change: 0 additions & 1 deletion src-docs/src/views/flyout/flyout.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default () => {
if (isFlyoutVisible) {
flyout = (
<EuiFlyout
ownFocus
onClose={() => setIsFlyoutVisible(false)}
aria-labelledby="flyoutTitle">
<EuiFlyoutHeader hasBorder>
Expand Down
5 changes: 1 addition & 4 deletions src-docs/src/views/flyout/flyout_banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ export default () => {

if (isFlyoutVisible) {
flyout = (
<EuiFlyout
ownFocus
onClose={closeFlyout}
aria-labelledby="flyoutWithBannerTitle">
<EuiFlyout onClose={closeFlyout} aria-labelledby="flyoutWithBannerTitle">
<EuiFlyoutHeader hasBorder>
<EuiTitle size="m">
<h2 id="flyoutWithBannerTitle">A flyout with a banner</h2>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/flyout/flyout_complicated.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ export default () => {
if (isFlyoutVisible) {
flyout = (
<EuiFlyout
ownFocus
onClose={closeFlyout}
hideCloseButton
aria-labelledby="flyoutComplicatedTitle">
Expand Down
59 changes: 20 additions & 39 deletions src-docs/src/views/flyout/flyout_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import FlyoutWithBanner from './flyout_banner';
const flyoutWithBannerSource = require('!!raw-loader!./flyout_banner');
const flyoutWithBannerHtml = renderToHtml(FlyoutWithBanner);

const flyOutSnippet = `<EuiFlyout ownFocus onClose={closeFlyout}>
const flyOutSnippet = `<EuiFlyout onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -49,7 +49,7 @@ const flyOutSnippet = `<EuiFlyout ownFocus onClose={closeFlyout}>
</EuiFlyout>
`;

const flyoutComplicatedSnippet = `<EuiFlyout ownFocus onClose={closeFlyout}>
const flyoutComplicatedSnippet = `<EuiFlyout onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -67,7 +67,7 @@ const flyoutComplicatedSnippet = `<EuiFlyout ownFocus onClose={closeFlyout}>
</EuiFlyout>
`;

const flyoutSmallSnippet = `<EuiFlyout size="s" onClose={closeFlyout}>
const flyoutSmallSnippet = `<EuiFlyout size="s" ownFocus onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -79,7 +79,7 @@ const flyoutSmallSnippet = `<EuiFlyout size="s" onClose={closeFlyout}>
</EuiFlyout>
`;

const flyoutMaxWidthSnippet = `<EuiFlyout ownFocus maxWidth={448} onClose={closeFlyout}>
const flyoutMaxWidthSnippet = `<EuiFlyout maxWidth={448} onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -91,7 +91,7 @@ const flyoutMaxWidthSnippet = `<EuiFlyout ownFocus maxWidth={448} onClose={close
</EuiFlyout>
`;

const flyoutLargeSnippet = `<EuiFlyout ownFocus size="l" onClose={closeFlyout}>
const flyoutLargeSnippet = `<EuiFlyout size="l" onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -103,7 +103,7 @@ const flyoutLargeSnippet = `<EuiFlyout ownFocus size="l" onClose={closeFlyout}>
</EuiFlyout>
`;

const flyoutWithBannerSnippet = `<EuiFlyout ownFocus onClose={closeFlyout}>
const flyoutWithBannerSnippet = `<EuiFlyout onClose={closeFlyout}>
<EuiFlyoutHeader hasBorder aria-labelledby={flyoutHeadingId}>
<EuiTitle>
<h2 id={flyoutHeadingId}><!-- Defaults to medium size. Change the heading level based on your context. --></h2>
Expand All @@ -130,24 +130,19 @@ export const FlyoutExample = {
},
],
text: (
<>
<div>
<p>
<strong>EuiFlyout</strong> is a fixed position panel that pops in
from the right side of the screen. It should be used any time you
need to perform quick, individual actions to a larger page or list.
</p>

<EuiCallOut
iconType="accessibility"
title={
<>
Use <EuiCode>{'aria-labelledby={headingId}'}</EuiCode> and{' '}
<EuiCode>ownFocus</EuiCode> to announce the flyout to screen
readers when the user opens it.
</>
}
/>
</>
<p>
For accessibility, use{' '}
<EuiCode>{'aria-labelledby={headingId}'}</EuiCode> to announce the
flyout to screen readers when the user opens it.
</p>
</div>
),
props: { EuiFlyout, EuiFlyoutHeader, EuiFlyoutBody },
snippet: flyOutSnippet,
Expand Down Expand Up @@ -200,7 +195,7 @@ export const FlyoutExample = {
demo: <FlyoutWithBanner />,
},
{
title: 'Small flyout, without ownFocus',
title: 'Small flyout, ownFocus',
source: [
{
type: GuideSectionTypes.JS,
Expand All @@ -212,26 +207,12 @@ export const FlyoutExample = {
},
],
text: (
<>
<p>
In this example, we set <EuiCode>size</EuiCode> to{' '}
<EuiCode>s</EuiCode> and remove the <EuiCode>ownFocus</EuiCode>{' '}
prop. The latter not only removes the focus trap around the flyout,
but also removes the background overlay that reinforces your
boundaries.
</p>
<EuiCallOut
iconType="accessibility"
color="warning"
title={
<>
Removing <EuiCode>ownFocus</EuiCode> makes it difficult for
keyboard-only and screen reader users to navigate to and from
your flyout.
</>
}
/>
</>
<p>
In this example, we set <EuiCode>size</EuiCode> to{' '}
<EuiCode>s</EuiCode> and apply the <EuiCode>ownFocus</EuiCode> prop.
The latter not only traps the focus of our flyout, but also adds
background overlay to reinforce your boundaries.
</p>
),
snippet: flyoutSmallSnippet,
demo: <FlyoutSmall />,
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/flyout/flyout_large.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default () => {
if (isFlyoutVisible) {
flyout = (
<EuiFlyout
ownFocus
onClose={closeFlyout}
size="l"
aria-labelledby="flyoutLargeTitle">
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/flyout/flyout_max_width.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default () => {

flyout = (
<EuiFlyout
ownFocus
onClose={closeFlyout}
aria-labelledby="flyoutMaxWidthTitle"
size={flyoutSize}
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/flyout/flyout_small.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default () => {
if (isFlyoutVisible) {
flyout = (
<EuiFlyout
ownFocus
onClose={closeFlyout}
size="s"
aria-labelledby="flyoutSmallTitle">
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/modal/modal_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const ModalExample = {
<p>
Use a modal to temporarily interrupt a user’s current task and block
interactions to the content below it. Be sure to read the full{' '}
<Link to="/layout/modal/guidelines">modal usage guidelines</Link>.
<Link to="/guidelines/modals">modal usage guidelines</Link>.
</p>
),
props: { EuiModal, EuiOverlayMask },
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default () => {

return (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default () => {

return (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default () => {
return (
<EuiPanel panelRef={setPanelRef}>
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
65 changes: 23 additions & 42 deletions src-docs/src/views/popover/popover_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
EuiPopover,
EuiPopoverTitle,
EuiPopoverFooter,
EuiCallOut,
} from '../../../../src/components';

import Popover from './popover';
Expand Down Expand Up @@ -58,7 +57,6 @@ const inputPopoverSource = require('!!raw-loader!./input_popover');
const inputPopoverHtml = renderToHtml(PopoverBlock);

const popOverSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand All @@ -67,13 +65,13 @@ const popOverSnippet = `<EuiPopover

const trapFocusSnippet = `<EuiPopover
button={button}
ownFocus
isOpen={isPopoverOpen}
closePopover={closePopover}>
<!-- Popover content -->
</EuiPopover>`;

const popoverAnchorSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -82,7 +80,6 @@ const popoverAnchorSnippet = `<EuiPopover
</EuiPopover>`;

const popoverWithTitleSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand All @@ -102,7 +99,6 @@ const popoverPanelClassNameSnippet = `<EuiPopover
</EuiPopover>`;

const popoverWithTitlePaddingSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -112,7 +108,6 @@ const popoverWithTitlePaddingSnippet = `<EuiPopover
</EuiPopover>`;

const popoverContainerSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -121,7 +116,6 @@ const popoverContainerSnippet = `<EuiPopover
</EuiPopover>`;

const popoverFixedSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand All @@ -130,7 +124,6 @@ const popoverFixedSnippet = `<EuiPopover
</EuiPopover>`;

const popoverBlockSnippet = `<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down Expand Up @@ -169,6 +162,28 @@ export const PopoverExample = {
snippet: popOverSnippet,
demo: <Popover />,
},
{
title: 'Trap focus',
source: [
{
type: GuideSectionTypes.JS,
code: trapFocusSource,
},
{
type: GuideSectionTypes.HTML,
code: trapFocusHtml,
},
],
text: (
<p>
If the popover should be responsible for trapping the focus within
itself (as opposed to a child component), then you should set{' '}
<EuiCode>ownFocus</EuiCode>.
</p>
),
snippet: trapFocusSnippet,
demo: <TrapFocus />,
},
{
title: 'Anchor position',
source: [
Expand Down Expand Up @@ -420,39 +435,5 @@ export const PopoverExample = {
snippet: inputPopoverSnippet,
demo: <InputPopover />,
},
{
title: 'Removing the focus focus',
source: [
{
type: GuideSectionTypes.JS,
code: trapFocusSource,
},
{
type: GuideSectionTypes.HTML,
code: trapFocusHtml,
},
],
text: (
<>
<p>
If the popover cannot trap focus within itself, then you can remove{' '}
<EuiCode>ownFocus</EuiCode>.
</p>
<EuiCallOut
iconType="accessibility"
color="warning"
title={
<>
Removing <EuiCode>ownFocus</EuiCode> makes it difficult for
keyboard-only and screen reader users to navigate to and from
your popover.
</>
}
/>
</>
),
snippet: trapFocusSnippet,
demo: <TrapFocus />,
},
],
};
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_fixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default () => {
<EuiButton onClick={toggleExample}>Toggle Example</EuiButton>
{isExampleShown && (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/popover/popover_htmlelement_anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const PopoverApp = props => {

return (
<EuiWrappingPopover
ownFocus
button={props.anchor}
isOpen={isPopoverOpen}
closePopover={closePopover}>
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/popover/trap_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default () => {

return (
<EuiPopover
ownFocus
button={button}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
Loading

0 comments on commit bacd494

Please sign in to comment.