Skip to content

Commit

Permalink
fixing color and toggle accessibility (elastic#54661)
Browse files Browse the repository at this point in the history
* fixing color and toggle accessibility

* updating snapshots

* fixing more snapshots

* fixing toggle console warning
  • Loading branch information
timductive committed Jan 14, 2020
1 parent dec9c21 commit 451f7be
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const PaletteArgInput = ({ onValueChange, argValue, renderError }) => {

const palette = astToPalette(argValue);

return <PalettePicker value={palette} onChange={handleChange} />;
return (
<PalettePicker value={palette} onChange={handleChange} ariaLabel={strings.getDisplayName()} />
);
};

PaletteArgInput.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const ShapeArgInput = ({ onValueChange, argValue, typeInstance }) => (
value={argValue}
onChange={onValueChange}
shapes={typeInstance.options.shapes}
ariaLabel={typeInstance.displayName}
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ArgumentStrings } from '../../../i18n';

const { Toggle: strings } = ArgumentStrings;

const ToggleArgInput = ({ onValueChange, argValue, argId, renderError }) => {
const ToggleArgInput = ({ onValueChange, argValue, argId, renderError, typeInstance }) => {
const handleChange = () => onValueChange(!argValue);
if (typeof argValue !== 'boolean') {
renderError();
Expand All @@ -26,6 +26,9 @@ const ToggleArgInput = ({ onValueChange, argValue, argId, renderError }) => {
checked={argValue}
onChange={handleChange}
className="canvasArg__switch"
aria-label={typeInstance.displayName}
label=""
showLabel={false}
/>
</EuiFormRow>
);
Expand Down
10 changes: 9 additions & 1 deletion x-pack/legacy/plugins/canvas/i18n/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,10 @@ export const ComponentStrings = {
i18n.translate('xpack.canvas.textStylePicker.styleUnderlineOption', {
defaultMessage: 'Underline',
}),
getFontColorLabel: () =>
i18n.translate('xpack.canvas.textStylePicker.fontColorLabel', {
defaultMessage: 'Font Color',
}),
},
TimePicker: {
getApplyButtonLabel: () =>
Expand Down Expand Up @@ -1007,7 +1011,11 @@ export const ComponentStrings = {
getUSLetterButtonLabel: () =>
i18n.translate('xpack.canvas.workpadConfig.USLetterButtonLabel', {
defaultMessage: 'US Letter',
description: 'This is referring to the dimentions of U.S. standard letter paper.',
description: 'This is referring to the dimensions of U.S. standard letter paper.',
}),
getBackgroundColorLabel: () =>
i18n.translate('xpack.canvas.workpadConfig.backgroundColorLabel', {
defaultMessage: 'Background color',
}),
},
WorkpadCreate: {
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const ColorPalette: FunctionComponent<Props> = ({
key={color}
onClick={() => !match && onChange(color)}
className="canvasColorPalette__dot"
aria-label={tinycolor(color).toName() || color}
>
<ColorDot value={color}>{icon}</ColorDot>
</EuiLink>
Expand Down
Loading

0 comments on commit 451f7be

Please sign in to comment.