Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(popover): fix a11y for popover #636

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/help/src/__snapshots__/Help.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Help> Render Should render Help component 1`] = `
<span
<button
className="af-popover__wrapper"
onClick={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
type="button"
>
<div
className="af-popover__container"
Expand All @@ -25,5 +27,5 @@ exports[`<Help> Render Should render Help component 1`] = `
</button>
</div>
</div>
</span>
</button>
`;
11 changes: 8 additions & 3 deletions packages/popover/src/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const PopoverClick = props => {
};
});

const click = (event) => {
const click = event => {
setOpen(!isOpen && isHover);
event.stopPropagation();
};
Expand All @@ -54,15 +54,20 @@ export const PopoverClick = props => {
};

return (
<span onMouseEnter={enter} onMouseLeave={leave} onClick={click}>
<button
className="af-popover__wrapper"
type="button"
onMouseEnter={enter}
onMouseLeave={leave}
onClick={click}>
<PopoverBase
isOpen={isOpen}
placement={placement}
className={className}
classModifier={classModifier}>
{children}
</PopoverBase>
</span>
</button>
);
};

Expand Down
6 changes: 6 additions & 0 deletions packages/popover/src/popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ $arrow-offset: -4px;
$padding-popover: 0.5rem;

.af-popover {
&__wrapper {
background: inherit;
border: 0;
padding: 0;
}

&__container {
display: inline-block;

Expand Down