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

fix: make elements accessible by keyboard navigation tools #1339

Merged
merged 3 commits into from
Aug 4, 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
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"polished": "^3.6.5",
"prismjs": "^1.20.0",
"prop-types": "^15.7.2",
"react-dropdown-aria": "^2.0.6",
"react-dropdown-aria": "^2.0.7",
"react-tabs": "^3.1.1",
"slugify": "^1.4.4",
"stickyfill": "^1.1.1",
Expand Down
16 changes: 12 additions & 4 deletions src/common-elements/schema.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import styled from '../styled-components';
import { darken } from 'polished';

export const OneOfList = styled.ul`
export const OneOfList = styled.div`
margin: 0 0 3px 0;
padding: 0;
list-style: none;
display: inline-block;
`;

Expand All @@ -15,20 +14,29 @@ export const OneOfLabel = styled.span`
}
`;

export const OneOfButton = styled.li<{ active: boolean }>`
export const OneOfButton = styled.button<{ active: boolean }>`
display: inline-block;
margin-right: 10px;
margin-bottom: 5px;
font-size: 0.8em;
cursor: pointer;
border: 1px solid ${props => props.theme.colors.primary.main};
padding: 2px 10px;
line-height: 1.5em;
outline: none;
&:focus {
box-shadow: 0 0 0 1px ${props => props.theme.colors.primary.main};
}

${props => {
if (props.active) {
return `
color: white;
background-color: ${props.theme.colors.primary.main};
&:focus {
box-shadow: none;
background-color: ${darken(0.15, props.theme.colors.primary.main)};
}
`;
} else {
return `
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectOnClick/SelectOnClick.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class SelectOnClick extends React.PureComponent {
onClick={this.selectElement}
onFocus={this.selectElement}
tabIndex={0}
role="button"
>
{children}
</div>
Expand Down