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

Start adding labels for a11y #789

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions src/components/block/__snapshots__/spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -117,6 +118,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -146,6 +148,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -175,6 +178,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -204,6 +208,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -233,6 +238,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -262,6 +268,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -291,6 +298,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -320,6 +328,7 @@ exports[`Block \`triangle="hide"\` 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -480,6 +489,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -509,6 +519,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -538,6 +549,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -567,6 +579,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -596,6 +609,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -625,6 +639,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -654,6 +669,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -683,6 +699,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -712,6 +729,7 @@ exports[`Block renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -800,6 +818,7 @@ exports[`BlockSwatches renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -829,6 +848,7 @@ exports[`BlockSwatches renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down Expand Up @@ -858,6 +878,7 @@ exports[`BlockSwatches renders correctly 1`] = `
<div
onClick={[Function]}
onKeyDown={[Function]}
role="button"
style={
Object {
"MozBorderRadius": "4px",
Expand Down
8 changes: 6 additions & 2 deletions src/components/circle/Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ColorWrap } from '../common'
import CircleSwatch from './CircleSwatch'

export const Circle = ({ width, onChange, onSwatchHover, colors, hex, circleSize,
styles: passedStyles = {}, circleSpacing, className = '' }) => {
styles: passedStyles = {}, circleSpacing, className = '', colorLabels = [] }) => {
const styles = reactCSS(merge({
'default': {
card: {
Expand All @@ -26,10 +26,11 @@ export const Circle = ({ width, onChange, onSwatchHover, colors, hex, circleSize

return (
<div style={ styles.card } className={ `circle-picker ${ className }` }>
{ map(colors, c => (
{ map(colors, (c, i) => (
<CircleSwatch
key={ c }
color={ c }
label={ colorLabels[i] }
onClick={ handleChange }
onSwatchHover={ onSwatchHover }
active={ hex === c.toLowerCase() }
Expand Down Expand Up @@ -58,6 +59,9 @@ Circle.defaultProps = {
material.green['500'], material.lightGreen['500'], material.lime['500'],
material.yellow['500'], material.amber['500'], material.orange['500'],
material.deepOrange['500'], material.brown['500'], material.blueGrey['500']],
colorLabels: ['red', 'pink', 'purple', 'deep purple', 'indigo', 'blue',
'light blue', 'cyan', 'teal', 'green', 'light green', 'lime', 'yellow',
'amber', 'orange', 'deep orange', 'brown', 'blue grey'],
styles: {},
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/circle/CircleSwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import reactCSS, { handleHover } from 'reactcss'
import { Swatch } from '../common'

export const CircleSwatch = ({ color, onClick, onSwatchHover, hover, active,
circleSize, circleSpacing }) => {
circleSize, circleSpacing, label }) => {
const styles = reactCSS({
'default': {
swatch: {
Expand Down Expand Up @@ -39,6 +39,7 @@ export const CircleSwatch = ({ color, onClick, onSwatchHover, hover, active,
<Swatch
style={ styles.Swatch }
color={ color }
label={ label }
onClick={ onClick }
onHover={ onSwatchHover }
focusStyle={{ boxShadow: `${ styles.Swatch.boxShadow }, 0 0 5px ${ color }` }}
Expand Down
Loading