Skip to content

bug: ion-button is treated as disabled by VoiceOver when passed disabled={"false"} prop #27930

Open
@llostris

Description

@llostris

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

IonButton componen, when passed disabled={false} prop, will be shown to the user as enabled, but treated as disabled by accessibility tooling (macOS Voiceover).

The generated HTML for the following React code:

<IonButton disabled={false}>Disabled=False</IonButton>

is this:

<ion-button disabled="false" class="ios button button-solid ion-activatable ion-focusable">Disabled=False</ion-button>

Note 1: There's a disabled="false" attribute, which according to HTML spec means that this button is disabled (see documentation about boolean attributes and disabled attribute which is a boolean attribute.

Note 2: Ionic displays this button as enabled:
Screenshot 2023-08-03 at 12 27 29

So this is inconsistent behaviour.

Expected Behavior

Considering Ionic displays this button as enabled, I believe the generated HTML should look as follows:

<ion-button class="ios button button-solid ion-activatable ion-focusable">Disabled=False</ion-button>

without disabled="false" prop.

Steps to Reproduce

<IonButton disabled={false}>Disabled=False</IonButton>

You can now inspect the button and see that it's rendered as:

<ion-button disabled="false" class="ios button button-solid ion-activatable ion-focusable">Disabled=False</ion-button>

And displayed as
Screenshot 2023-08-03 at 12 27 29

So:

  • It has enabled button styling

Code Reproduction URL

https://stackblitz.com/edit/ztrqwi?file=src%2Fmain.tsx

Ionic Info


Ionic:

   Ionic CLI       : 7.0.1 (/Users/magdalenastrzoda/.config/yarn/global/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 7.2.2

Capacitor:

   Capacitor CLI      : 4.7.3
   @capacitor/android : 4.7.3
   @capacitor/core    : 4.7.3
   @capacitor/ios     : 4.7.3

Utility:

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

System:

   NodeJS : v18.15.0 (/Users/magdalenastrzoda/.nvm/versions/node/v18.15.0/bin/node)
   npm    : 9.5.0
   OS     : macOS Monterey


  ───────────────────────────────────────────────

     Ionic CLI update available: 7.0.1 → 7.1.1
         Run npm i -g @ionic/cli to update

  ───────────────────────────────────────────────

### Additional Information

We've seen this behaviour both on 7.0.x and 7.2.x versions of Ionic for React.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stencilIssues that require changes in Stenciltype: buga confirmed bug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions