From 3bdb91adf9cbb90bb294275829d5bb5ee1fe40d2 Mon Sep 17 00:00:00 2001 From: dakahn Date: Thu, 5 Dec 2019 11:36:19 -0600 Subject: [PATCH 01/13] fix(filter): add role button and update story for clarity --- packages/react/src/components/Tag/Tag-story.js | 2 +- packages/react/src/components/Tag/Tag.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/Tag/Tag-story.js b/packages/react/src/components/Tag/Tag-story.js index be94ef51a9f3..1b9ddcf8971a 100644 --- a/packages/react/src/components/Tag/Tag-story.js +++ b/packages/react/src/components/Tag/Tag-story.js @@ -26,7 +26,7 @@ const props = { 'red' ), disabled: boolean('Disabled (disabled)', false), - title: 'Clear Selection', + title: 'Clear Filter', }), filter() { return { ...this.regular(), onClick: action('onClick') }; diff --git a/packages/react/src/components/Tag/Tag.js b/packages/react/src/components/Tag/Tag.js index a13c40faea37..39dfe0676ef5 100644 --- a/packages/react/src/components/Tag/Tag.js +++ b/packages/react/src/components/Tag/Tag.js @@ -43,6 +43,7 @@ const Tag = ({ return filter ? ( From 49a2e0dc88c77fce0807872205190aec0511c38c Mon Sep 17 00:00:00 2001 From: "D.A. Kahn" Date: Mon, 9 Dec 2019 17:49:08 -0600 Subject: [PATCH 02/13] fix(tag): change span to button, remove role and add button-reset helper --- packages/react/src/components/Tag/Tag.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/react/src/components/Tag/Tag.js b/packages/react/src/components/Tag/Tag.js index 39dfe0676ef5..2f935285c742 100644 --- a/packages/react/src/components/Tag/Tag.js +++ b/packages/react/src/components/Tag/Tag.js @@ -41,19 +41,18 @@ const Tag = ({ [`${prefix}--tag--filter`]: filter, }); return filter ? ( - {children !== null && children !== undefined ? children : TYPES[type]} - + ) : ( - + ); }; From 5ad6d504ce18a7e26b0bdcdbac1d00de0fe9172b Mon Sep 17 00:00:00 2001 From: "D.A. Kahn" Date: Mon, 9 Dec 2019 17:53:36 -0600 Subject: [PATCH 03/13] fix(tag): add button-reset to tag styling --- packages/components/src/components/tag/_tag.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/components/tag/_tag.scss b/packages/components/src/components/tag/_tag.scss index b6c19da5843d..eba5e4ecc693 100644 --- a/packages/components/src/components/tag/_tag.scss +++ b/packages/components/src/components/tag/_tag.scss @@ -17,6 +17,7 @@ @mixin tags { .#{$prefix}--tag { @include type-style('label-01'); + @include button-reset($width: false); display: inline-flex; align-items: center; padding: 0 $carbon--spacing-03; From 180be7ff2dfd5fb3f6cfffc1210826d42d7a2fd4 Mon Sep 17 00:00:00 2001 From: "D.A. Kahn" Date: Tue, 10 Dec 2019 12:10:59 -0600 Subject: [PATCH 04/13] test(tag): add Axe test --- packages/react/src/components/Tag/Tag-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/components/Tag/Tag-test.js b/packages/react/src/components/Tag/Tag-test.js index 48fbd294f0f2..8db34cc6262f 100644 --- a/packages/react/src/components/Tag/Tag-test.js +++ b/packages/react/src/components/Tag/Tag-test.js @@ -20,7 +20,7 @@ describe('Tag', () => { describe('automated accessibility testing', () => { it('should have no Axe violations', async () => { - const { container } = render(); + const { container } = render(This is not a tag); await expect(container).toHaveNoAxeViolations(); }); }); From ba059f0b66ad742b8daa52975a9d0062e47a0e99 Mon Sep 17 00:00:00 2001 From: "D.A. Kahn" Date: Tue, 10 Dec 2019 15:55:46 -0600 Subject: [PATCH 05/13] fix(tag): remove unused aria, title, tab-index; add DAP --- packages/react/src/components/Tag/Tag-test.js | 9 +++++++++ packages/react/src/components/Tag/Tag.js | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/react/src/components/Tag/Tag-test.js b/packages/react/src/components/Tag/Tag-test.js index 8db34cc6262f..fc1fe3289fa9 100644 --- a/packages/react/src/components/Tag/Tag-test.js +++ b/packages/react/src/components/Tag/Tag-test.js @@ -23,6 +23,15 @@ describe('Tag', () => { const { container } = render(This is not a tag); await expect(container).toHaveNoAxeViolations(); }); + + it('should have no DAP violations', async () => { + const { container } = render(This is not a tag); + await expect(container).toHaveNoDAPViolations('Tag'); + }); + }); + + describe('with a screenreader', () => { + afterEach(cleanup); }); describe('Renders as expected', () => { diff --git a/packages/react/src/components/Tag/Tag.js b/packages/react/src/components/Tag/Tag.js index 2f935285c742..fcf14e04caa0 100644 --- a/packages/react/src/components/Tag/Tag.js +++ b/packages/react/src/components/Tag/Tag.js @@ -43,11 +43,10 @@ const Tag = ({ return filter ? ( ) : (