diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/palette.js b/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/palette.js index 69f584af41556..d60dc13f0105b 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/palette.js +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/palette.js @@ -61,7 +61,9 @@ const PaletteArgInput = ({ onValueChange, argValue, renderError }) => { const palette = astToPalette(argValue); - return ; + return ( + + ); }; PaletteArgInput.propTypes = { diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/shape.js b/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/shape.js index c056e7d1f2281..baa2127b03c3c 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/shape.js +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/shape.js @@ -20,6 +20,7 @@ const ShapeArgInput = ({ onValueChange, argValue, typeInstance }) => ( value={argValue} onChange={onValueChange} shapes={typeInstance.options.shapes} + ariaLabel={typeInstance.displayName} /> diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/toggle.js b/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/toggle.js index de19d3e29221b..bcad4678e0b6a 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/toggle.js +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/uis/arguments/toggle.js @@ -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(); @@ -26,6 +26,9 @@ const ToggleArgInput = ({ onValueChange, argValue, argId, renderError }) => { checked={argValue} onChange={handleChange} className="canvasArg__switch" + aria-label={typeInstance.displayName} + label="" + showLabel={false} /> ); diff --git a/x-pack/legacy/plugins/canvas/i18n/components.ts b/x-pack/legacy/plugins/canvas/i18n/components.ts index c898db7467b44..d0a9051d7af87 100644 --- a/x-pack/legacy/plugins/canvas/i18n/components.ts +++ b/x-pack/legacy/plugins/canvas/i18n/components.ts @@ -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: () => @@ -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: { diff --git a/x-pack/legacy/plugins/canvas/public/components/color_palette/__examples__/__snapshots__/color_palette.examples.storyshot b/x-pack/legacy/plugins/canvas/public/components/color_palette/__examples__/__snapshots__/color_palette.examples.storyshot index badbf96029f12..8610ed2f1b4a3 100644 --- a/x-pack/legacy/plugins/canvas/public/components/color_palette/__examples__/__snapshots__/color_palette.examples.storyshot +++ b/x-pack/legacy/plugins/canvas/public/components/color_palette/__examples__/__snapshots__/color_palette.examples.storyshot @@ -8,6 +8,7 @@ exports[`Storyshots components/Color/ColorPalette interactive 1`] = ` className="item-grid-row" > = ({ key={color} onClick={() => !match && onChange(color)} className="canvasColorPalette__dot" + aria-label={tinycolor(color).toName() || color} > {icon} diff --git a/x-pack/legacy/plugins/canvas/public/components/color_picker/__examples__/__snapshots__/color_picker.examples.storyshot b/x-pack/legacy/plugins/canvas/public/components/color_picker/__examples__/__snapshots__/color_picker.examples.storyshot index 6e25ce3d4b0d4..5fbb4ee7d584d 100644 --- a/x-pack/legacy/plugins/canvas/public/components/color_picker/__examples__/__snapshots__/color_picker.examples.storyshot +++ b/x-pack/legacy/plugins/canvas/public/components/color_picker/__examples__/__snapshots__/color_picker.examples.storyshot @@ -10,6 +10,7 @@ exports[`Storyshots components/Color/ColorPicker interactive 1`] = ` className="item-grid-row" > @@ -72,6 +73,7 @@ storiesOf('components/Color/ColorPickerPopover', module) anchorPosition="downCenter" onChange={action('onChange')} colors={THREE_COLORS} + ariaLabel="Color Picker" /> )) .add('six colors', () => ( @@ -80,6 +82,7 @@ storiesOf('components/Color/ColorPickerPopover', module) anchorPosition="downCenter" onChange={action('onChange')} colors={SIX_COLORS} + ariaLabel="Color Picker" /> )) .add('six colors, value missing', () => ( @@ -88,6 +91,7 @@ storiesOf('components/Color/ColorPickerPopover', module) anchorPosition="downCenter" onChange={action('onChange')} colors={SIX_COLORS} + ariaLabel="Color Picker" /> )) .add('interactive', () => , { diff --git a/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx b/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx index 9961eba74a19d..95d6144f3e3c3 100644 --- a/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx @@ -7,18 +7,24 @@ import { EuiLink, PopoverAnchorPosition } from '@elastic/eui'; import PropTypes from 'prop-types'; import React, { FunctionComponent, MouseEvent } from 'react'; +import tinycolor from 'tinycolor2'; import { ColorDot } from '../color_dot'; import { ColorPicker, Props as ColorPickerProps } from '../color_picker'; import { Popover } from '../popover'; export interface Props extends ColorPickerProps { anchorPosition: PopoverAnchorPosition; + ariaLabel?: string; } export const ColorPickerPopover: FunctionComponent = (props: Props) => { - const { value, anchorPosition, ...rest } = props; + const { value, anchorPosition, ariaLabel, ...rest } = props; const button = (handleClick: (ev: MouseEvent) => void) => ( - + ); diff --git a/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js b/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js index 254d9647e26a7..e5808dd623530 100644 --- a/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js +++ b/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js @@ -12,9 +12,9 @@ import { Popover } from '../popover'; import { PaletteSwatch } from '../palette_swatch'; import { palettes } from '../../../common/lib/palettes'; -export const PalettePicker = ({ onChange, value, anchorPosition }) => { +export const PalettePicker = ({ onChange, value, anchorPosition, ariaLabel }) => { const button = handleClick => ( - + ); diff --git a/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx b/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx index 970f72da698ba..717ec6d0faecc 100644 --- a/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx @@ -17,12 +17,13 @@ interface Props { }; onChange?: (key: string) => void; value?: string; + ariaLabel?: string; } -export const ShapePickerPopover = ({ shapes, onChange, value }: Props) => { +export const ShapePickerPopover = ({ shapes, onChange, value, ariaLabel }: Props) => { const button = (handleClick: (ev: MouseEvent) => void) => ( - + diff --git a/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js b/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js index 1a44181475091..179455e15b36e 100644 --- a/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js +++ b/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js @@ -127,6 +127,7 @@ export const TextStylePicker = ({ value={color} onChange={value => doChange('color', value)} colors={colors} + ariaLabel={strings.getFontColorLabel()} /> diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx b/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx index 69401c89c79a5..c81f3e78efddd 100644 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx @@ -6,9 +6,18 @@ import React from 'react'; import { ColorPickerPopover, Props } from '../color_picker_popover'; +import { ComponentStrings } from '../../../i18n'; + +const { WorkpadConfig: strings } = ComponentStrings; export const WorkpadColorPicker = (props: Props) => { - return ; + return ( + + ); }; WorkpadColorPicker.propTypes = ColorPickerPopover.propTypes; diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js index 2a47150b4a1b9..8d756dd8111b1 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js @@ -13,10 +13,15 @@ import { ArgTypesStrings } from '../../../i18n'; const { Color: strings } = ArgTypesStrings; -const ColorArgInput = ({ onValueChange, argValue, workpad }) => ( +const ColorArgInput = ({ onValueChange, argValue, workpad, typeInstance }) => ( - + ); diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot index 2915d3bfef57b..649d11cb2dbab 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot @@ -467,6 +467,7 @@ exports[`Storyshots arguments/ContainerStyle extended 1`] = ` className="euiPopover__anchor" > = ({ onChange={borderColorChange} colors={colors} anchorPosition="upCenter" + ariaLabel={strings.getBorderTitle()} /> diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx index 11e000e08481f..cb7a5d606c7d9 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx @@ -8,6 +8,9 @@ import React, { FunctionComponent } from 'react'; import PropTypes from 'prop-types'; import { ColorPickerPopover } from '../../../components/color_picker_popover'; import { CanvasWorkpad } from '../.../../../../../types'; +import { ArgTypesStrings } from '../../../../i18n'; + +const { ContainerStyle: strings } = ArgTypesStrings; export interface Arguments { backgroundColor: string; @@ -27,6 +30,7 @@ export const SimpleTemplate: FunctionComponent = ({ getArgValue, setArgVa onChange={color => setArgValue('backgroundColor', color)} colors={workpad.colors} anchorPosition="leftCenter" + ariaLabel={strings.getDisplayName()} /> ); diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx index e05c48b97f54a..ba1f4305167a4 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx @@ -76,6 +76,7 @@ export const SimpleTemplate: FunctionComponent = props => { colors={workpad.colors} onChange={val => handleChange('color', val)} value={color} + ariaLabel={strings.getColorLabel()} />
@@ -72,6 +73,7 @@ storiesOf('components/Color/ColorPickerPopover', module) anchorPosition="downCenter" onChange={action('onChange')} colors={THREE_COLORS} + ariaLabel="Color Picker" /> )) .add('six colors', () => ( @@ -80,6 +82,7 @@ storiesOf('components/Color/ColorPickerPopover', module) anchorPosition="downCenter" onChange={action('onChange')} colors={SIX_COLORS} + ariaLabel="Color Picker" /> )) .add('six colors, value missing', () => ( @@ -88,6 +91,7 @@ storiesOf('components/Color/ColorPickerPopover', module) anchorPosition="downCenter" onChange={action('onChange')} colors={SIX_COLORS} + ariaLabel="Color Picker" /> )) .add('interactive', () => , { diff --git a/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx b/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx index 9961eba74a19d..95d6144f3e3c3 100644 --- a/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/color_picker_popover/color_picker_popover.tsx @@ -7,18 +7,24 @@ import { EuiLink, PopoverAnchorPosition } from '@elastic/eui'; import PropTypes from 'prop-types'; import React, { FunctionComponent, MouseEvent } from 'react'; +import tinycolor from 'tinycolor2'; import { ColorDot } from '../color_dot'; import { ColorPicker, Props as ColorPickerProps } from '../color_picker'; import { Popover } from '../popover'; export interface Props extends ColorPickerProps { anchorPosition: PopoverAnchorPosition; + ariaLabel?: string; } export const ColorPickerPopover: FunctionComponent = (props: Props) => { - const { value, anchorPosition, ...rest } = props; + const { value, anchorPosition, ariaLabel, ...rest } = props; const button = (handleClick: (ev: MouseEvent) => void) => ( - + ); diff --git a/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js b/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js index 254d9647e26a7..e5808dd623530 100644 --- a/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js +++ b/x-pack/legacy/plugins/canvas/public/components/palette_picker/palette_picker.js @@ -12,9 +12,9 @@ import { Popover } from '../popover'; import { PaletteSwatch } from '../palette_swatch'; import { palettes } from '../../../common/lib/palettes'; -export const PalettePicker = ({ onChange, value, anchorPosition }) => { +export const PalettePicker = ({ onChange, value, anchorPosition, ariaLabel }) => { const button = handleClick => ( - + ); diff --git a/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx b/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx index 970f72da698ba..717ec6d0faecc 100644 --- a/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/shape_picker_popover/shape_picker_popover.tsx @@ -17,12 +17,13 @@ interface Props { }; onChange?: (key: string) => void; value?: string; + ariaLabel?: string; } -export const ShapePickerPopover = ({ shapes, onChange, value }: Props) => { +export const ShapePickerPopover = ({ shapes, onChange, value, ariaLabel }: Props) => { const button = (handleClick: (ev: MouseEvent) => void) => ( - + diff --git a/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js b/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js index 1a44181475091..179455e15b36e 100644 --- a/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js +++ b/x-pack/legacy/plugins/canvas/public/components/text_style_picker/text_style_picker.js @@ -127,6 +127,7 @@ export const TextStylePicker = ({ value={color} onChange={value => doChange('color', value)} colors={colors} + ariaLabel={strings.getFontColorLabel()} /> diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx b/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx index 69401c89c79a5..c81f3e78efddd 100644 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/workpad_color_picker/workpad_color_picker.tsx @@ -6,9 +6,18 @@ import React from 'react'; import { ColorPickerPopover, Props } from '../color_picker_popover'; +import { ComponentStrings } from '../../../i18n'; + +const { WorkpadConfig: strings } = ComponentStrings; export const WorkpadColorPicker = (props: Props) => { - return ; + return ( + + ); }; WorkpadColorPicker.propTypes = ColorPickerPopover.propTypes; diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js index 2a47150b4a1b9..8d756dd8111b1 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/color.js @@ -13,10 +13,15 @@ import { ArgTypesStrings } from '../../../i18n'; const { Color: strings } = ArgTypesStrings; -const ColorArgInput = ({ onValueChange, argValue, workpad }) => ( +const ColorArgInput = ({ onValueChange, argValue, workpad, typeInstance }) => ( - + ); diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot index 2915d3bfef57b..649d11cb2dbab 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/__examples__/__snapshots__/extended_template.examples.storyshot @@ -467,6 +467,7 @@ exports[`Storyshots arguments/ContainerStyle extended 1`] = ` className="euiPopover__anchor" > = ({ onChange={borderColorChange} colors={colors} anchorPosition="upCenter" + ariaLabel={strings.getBorderTitle()} /> diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx index 11e000e08481f..cb7a5d606c7d9 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/container_style/simple_template.tsx @@ -8,6 +8,9 @@ import React, { FunctionComponent } from 'react'; import PropTypes from 'prop-types'; import { ColorPickerPopover } from '../../../components/color_picker_popover'; import { CanvasWorkpad } from '../.../../../../../types'; +import { ArgTypesStrings } from '../../../../i18n'; + +const { ContainerStyle: strings } = ArgTypesStrings; export interface Arguments { backgroundColor: string; @@ -27,6 +30,7 @@ export const SimpleTemplate: FunctionComponent = ({ getArgValue, setArgVa onChange={color => setArgValue('backgroundColor', color)} colors={workpad.colors} anchorPosition="leftCenter" + ariaLabel={strings.getDisplayName()} /> ); diff --git a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx index e05c48b97f54a..ba1f4305167a4 100644 --- a/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx +++ b/x-pack/legacy/plugins/canvas/public/expression_types/arg_types/series_style/simple_template.tsx @@ -76,6 +76,7 @@ export const SimpleTemplate: FunctionComponent = props => { colors={workpad.colors} onChange={val => handleChange('color', val)} value={color} + ariaLabel={strings.getColorLabel()} />