Skip to content

Commit

Permalink
fix: make elements accessible by keyboard navigation tools (Redocly#1339
Browse files Browse the repository at this point in the history
)

* fix: make api endpoint selectable

* fix: make response schema details selectable

* fix: update react-dropdown-aria to make dropdowns selectable
  • Loading branch information
stasiukanya authored Aug 4, 2020
1 parent 3ae069c commit 2ce7189
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
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

0 comments on commit 2ce7189

Please sign in to comment.