From 989e619142b2fd62676ab8a24629de2623453895 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 23 Jan 2019 21:22:09 +0100 Subject: [PATCH] fixup! feat: add title prop to #icon, refactor and fix auto sizing --- .../__snapshots__/FormStatus.test.js.snap | 2 +- .../__snapshots__/IconPrimary.test.js.snap | 2 +- .../dnb-ui-lib/src/components/icon/Icon.js | 25 +++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/dnb-ui-lib/src/components/form-status/__tests__/__snapshots__/FormStatus.test.js.snap b/packages/dnb-ui-lib/src/components/form-status/__tests__/__snapshots__/FormStatus.test.js.snap index 1e131cd2737..b10f118425d 100644 --- a/packages/dnb-ui-lib/src/components/form-status/__tests__/__snapshots__/FormStatus.test.js.snap +++ b/packages/dnb-ui-lib/src/components/form-status/__tests__/__snapshots__/FormStatus.test.js.snap @@ -34,7 +34,7 @@ exports[`FormStatus component have to match snapshot 1`] = ` width={null} > 1) { const lastPartOfIconName = nameParts.reverse()[0] const potentialSize = ListDefaultIconSizes.filter( @@ -243,8 +248,12 @@ export default class Icon extends PureComponent { role: 'img', title }) + // get the alt - wrapperParams['aria-label'] = (alt || title || name).replace(/_/g, ' ') + wrapperParams['aria-label'] = String( + alt || title || Icon.getIconNameFromComponent(props) + ).replace(/_/g, ' ') + if (area_hidden) { // wrapperParams['role'] = 'presentation' // almost the same as aria-hidden wrapperParams['aria-hidden'] = area_hidden