ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.03k stars 13.51k forks source link

bug: expose role attribute on ion-alert + ion-toast #23825

Closed eric-horodyski closed 3 years ago

eric-horodyski commented 3 years ago

Prequisites

Ionic Framework Version

Current Behavior

While working with a community member, it was observed that there is no way to modify the role attribute for the IonToast and IonAlert components.

Expected Behavior

As a developer, I would like to have the ability to set the role attribute as my application would like to set this attribute to alert for both components.

IonAlert sets role="dialog" but in this application's accessibility context it needs to be set to "alert".

Steps to Reproduce

Using the AlertController and ToastController there is no ability to manually set the role attribute.

Code Reproduction URL

https://github.com/eric-horodyski/fw-ng-alert-toast-a11y

Ionic Info

Ionic:

   Ionic CLI                     : 6.17.0 (/Users/eric/.volta/tools/image/packages/@ionic/cli/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.6.14
   @angular-devkit/build-angular : 12.1.4
   @angular-devkit/schematics    : 12.2.2
   @angular/cli                  : 12.1.4
   @ionic/angular-toolkit        : 4.0.0

Capacitor:

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

Utility:

   cordova-res : 0.15.3
   native-run  : 1.4.0

System:

   NodeJS : v14.17.0 (/Users/eric/.volta/tools/image/node/14.17.0/bin/node)
   npm    : 7.14.0
   OS     : macOS Big Sur

Additional Information

No response

willmartian commented 3 years ago

Available in the next release of Framework, ion-toast and ion-alert will accept an htmlAttributes prop, which allows developers to pass arbitrary attributes to the host element, including role. Thanks!

ionitron-bot[bot] commented 3 years ago

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.