From 4951ea2cafeb33c8bdf48eec7fb5978250fcb2b1 Mon Sep 17 00:00:00 2001 From: Jim Unger Date: Thu, 10 Aug 2017 10:24:56 -0500 Subject: [PATCH] Adds getAriaName function and applies it to advanced settings --- .../sections/settings/advanced_row.html | 3 +++ .../settings/lib/__tests__/get_aria_name.js | 26 +++++++++++++++++++ .../sections/settings/lib/get_aria_name.js | 13 ++++++++++ .../settings/lib/to_editable_config.js | 3 +++ 4 files changed, 45 insertions(+) create mode 100644 src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_aria_name.js create mode 100644 src/core_plugins/kibana/public/management/sections/settings/lib/get_aria_name.js diff --git a/src/core_plugins/kibana/public/management/sections/settings/advanced_row.html b/src/core_plugins/kibana/public/management/sections/settings/advanced_row.html index 400ff1c4cf6a0..b1b62c526ebf3 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/advanced_row.html +++ b/src/core_plugins/kibana/public/management/sections/settings/advanced_row.html @@ -131,6 +131,7 @@ ng-click="edit(conf)" class="kuiMenuButton kuiMenuButton--basic kuiMenuButton--iconText" ng-disabled="conf.tooComplex" + aria-label="Edit {{conf.ariaName}}" data-test-subj="advancedSetting-{{conf.name}}-editButton" > 'x pack foo bar foo bar baz' + */ +export function getAriaName(name) { + return words(name).map(word => word.toLowerCase()).join(' '); +} diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js b/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js index fd837bc9630d3..a50abaf171560 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js @@ -1,5 +1,6 @@ import { getValType } from './get_val_type'; import { getEditorType } from './get_editor_type'; +import { getAriaName } from './get_aria_name'; /** * @param {object} advanced setting definition object @@ -13,6 +14,7 @@ export function toEditableConfig({ def, name, value, isCustom }) { } const conf = { name, + ariaName: getAriaName(name), value, isCustom, readonly: !!def.readonly, @@ -33,3 +35,4 @@ export function toEditableConfig({ def, name, value, isCustom }) { return conf; } +