ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: disabled checkbox should not be hidden from screen readers

Open mastergogo opened this issue 1 year ago • 1 comments

Prerequisites

Ionic Framework Version

  • [ ] v4.x
  • [X] v5.x
  • [X] v6.x
  • [ ] Nightly

Current Behavior

On a disable ion-checkbox, ionic is applying an aria-hidden attribute, which is hiding the element from the DOM tree, therefore screen readers such as TalkBack and Voiceover are skipping the entire element.

Expected Behavior

The disable ion-checkbox should not be hidden from the screen readers and should announce the disable properties of ion-checkbox such as "dim" for voiceover and "disabled" for TalkBack.

Steps to Reproduce

Create a simple disable ion-checkbox and navigate using the screen reader both Talk back and Voiceover and notice that how screen reader will skip and not announce the disable property of ion-checkbox, it can be misleading for the SR user.

Code Reproduction URL

https://github.com/mastergogo/disableIonicCheckBox

Ionic Info

Ionic:

Ionic CLI : 6.19.0 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/vue 6.2.1

Capacitor:

Capacitor CLI : 4.0.1 @capacitor/android : not installed @capacitor/core : 4.0.1 @capacitor/ios : not installed

Utility:

cordova-res : not installed globally native-run : 1.6.0

System:

NodeJS : v16.14.1 (/usr/local/bin/node) npm : 8.5.0 OS : macOS Monterey

Additional Information

Ionic should not apply aria-hidden to the element and let is behave like a native disable element which will provide the semantic meaning and state of the element to the user. Let me know if more info is needed from my side.

mastergogo avatar Aug 08 '22 14:08 mastergogo

Thanks for the issue. I can confirm that this is a bug. It looks like this behavior was added in https://github.com/ionic-team/ionic-framework/commit/7214a8401b709e1353155304cf6e9f97b2b4d294. The behavior was added in order to account for iOS/VoiceOver.

liamdebeasi avatar Aug 09 '22 14:08 liamdebeasi

Any chance this needs work @liamdebeasi? This should be a fairly straightforward change from aria-hidden to aria-disabled on the checkbox component. Not sure if this bug applies to other components as well, though.

bpmcneilly avatar Feb 17 '23 16:02 bpmcneilly

Thanks for the ping! So the aria-hidden was added to work around some quirks with how iOS/VoiceOver interacts with ion-checkbox, so removing that in favor of aria-disabled likely will cause behavior regressions on iOS. However, this is really due to how we've architected this component.

In Ionic 7 we are introducing a new checkbox architecture, and I was able to resolve the issue there. I have a PR up in https://github.com/ionic-team/ionic-framework/pull/26817.

liamdebeasi avatar Feb 17 '23 18:02 liamdebeasi

Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/26817, and a fix will be available in an upcoming release of the Ionic Framework v7 beta.

liamdebeasi avatar Feb 20 '23 14:02 liamdebeasi

Disabled checkboxes are still hidden from screen readers as aria-hidden is still applied to them, I could check this in ionic 7 beta, here is the repo for the same

mastergogo avatar Mar 01 '23 14:03 mastergogo

You need to use the new checkbox syntax as the fix is only available there (you should have a warning in your console):

<ion-item>
  <ion-checkbox disabled="true">I agree to the terms and conditions</ion-checkbox>
</ion-item>

liamdebeasi avatar Mar 01 '23 14:03 liamdebeasi

Got it, thanks!

mastergogo avatar Mar 01 '23 14:03 mastergogo

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Mar 31 '23 14:03 ionitron-bot[bot]