From 813611a61b664c9827760ccaa889d0e2fcae7d94 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Thu, 12 Nov 2020 15:29:05 -0500 Subject: [PATCH] fix(toggle): use a native input to fix a11y issues with axe and screen readers (#22477) fixes #22011 references #21552 --- .github/COMPONENT-GUIDE.md | 2 + .../components/toggle/test/basic/index.html | 4 +- .../components/toggle/test/sizes/index.html | 66 +++++++++---------- .../toggle/test/standalone/index.html | 26 ++++---- core/src/components/toggle/toggle.scss | 12 +++- core/src/components/toggle/toggle.tsx | 50 +++++++------- 6 files changed, 88 insertions(+), 72 deletions(-) diff --git a/.github/COMPONENT-GUIDE.md b/.github/COMPONENT-GUIDE.md index b9181ab25f..fb9de8eb38 100644 --- a/.github/COMPONENT-GUIDE.md +++ b/.github/COMPONENT-GUIDE.md @@ -10,6 +10,7 @@ * [Example Components](#example-components) * [References](#references) - [Accessibility](#accessibility) + * [Checkbox](#checkbox) - [Rendering Anchor or Button](#rendering-anchor-or-button) * [Example Components](#example-components-1) * [Component Structure](#component-structure-1) @@ -370,6 +371,7 @@ ion-ripple-effect { #### Example Components - [ion-checkbox](https://github.com/ionic-team/ionic/tree/master/core/src/components/checkbox) +- [ion-toggle](https://github.com/ionic-team/ionic/tree/master/core/src/components/toggle) #### VoiceOver diff --git a/core/src/components/toggle/test/basic/index.html b/core/src/components/toggle/test/basic/index.html index f86611f26b..815245d35c 100644 --- a/core/src/components/toggle/test/basic/index.html +++ b/core/src/components/toggle/test/basic/index.html @@ -18,7 +18,7 @@ Toggle - Basic - + @@ -86,7 +86,7 @@

- + Stand-alone toggle:

diff --git a/core/src/components/toggle/test/sizes/index.html b/core/src/components/toggle/test/sizes/index.html index b4a9f4fe1a..0d45635e1e 100644 --- a/core/src/components/toggle/test/sizes/index.html +++ b/core/src/components/toggle/test/sizes/index.html @@ -25,53 +25,53 @@

Default

- - - - - - + + + + + +

Custom Widths

- - - - - - + + + + + +

Custom Heights

- - + +
- - - - - + + + + +

Dynamic Sizes

- - - - + + + +

Complex Custom Toggles

- - + + - - + + - - + + - - + + - - + +
diff --git a/core/src/components/toggle/test/standalone/index.html b/core/src/components/toggle/test/standalone/index.html index ec617efb30..2f9e1de47a 100644 --- a/core/src/components/toggle/test/standalone/index.html +++ b/core/src/components/toggle/test/standalone/index.html @@ -13,23 +13,23 @@ - + - - - - - - - - - - + + + + + + + + + + - - + +