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 categories into accessible nav buttons #282

Merged
merged 3 commits into from
Mar 12, 2019
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ categories: {
symbols: 'Symbols',
flags: 'Flags',
custom: 'Custom',
}
},
categorieslabel: 'Emoji categories', // Accessible title for the list of categories
```

#### Sheet sizes
Expand Down
6 changes: 5 additions & 1 deletion css/emoji-mart.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
padding: 12px 4px;
overflow: hidden;
transition: color .1s ease-out;
margin: 0;
box-shadow: none;
background: none;
border: none;
}
.emoji-mart-anchor:hover,
.emoji-mart-anchor-selected {
Expand All @@ -74,7 +78,7 @@

.emoji-mart-anchors svg,
.emoji-mart-anchors img {
fill: currentColor;
fill: #858585;
height: 18px;
width: 18px;
}
Expand Down
9 changes: 5 additions & 4 deletions src/components/anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class Anchors extends React.PureComponent {
{ selected } = this.state

return (
<div className="emoji-mart-anchors">
<nav className="emoji-mart-anchors" aria-label={i18n.categorieslabel}>
{categories.map((category, i) => {
var { id, name, anchor } = category,
isSelected = name == selected
Expand All @@ -38,8 +38,9 @@ export default class Anchors extends React.PureComponent {
}

return (
<span
<button
key={id}
aria-label={i18n.categories[id]}
title={i18n.categories[id]}
data-index={i}
onClick={this.handleClick}
Expand All @@ -55,10 +56,10 @@ export default class Anchors extends React.PureComponent {
className="emoji-mart-anchor-bar"
style={{ backgroundColor: color }}
/>
</span>
</button>
)
})}
</div>
</nav>
)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/components/picker/nimble-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const I18N = {
flags: 'Flags',
custom: 'Custom',
},
categorieslabel: 'Emoji categories', // Accessible title for the list of categories
}

export default class NimblePicker extends React.PureComponent {
Expand Down