Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: buttons inside ion-header not accessible with screenreader (unless scrolled down) #29347

Closed
3 tasks done
johannesvollmer opened this issue Apr 17, 2024 · 3 comments · Fixed by #30027
Closed
3 tasks done
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@johannesvollmer
Copy link

johannesvollmer commented Apr 17, 2024

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Given

  • ion-header with collapse="condense"
  • buttons inside first ion-header (but not second ion-header)

When

  • user has not scrolled yet

Then

  • buttons are rendered and clickable as expected
  • however, the whole header will be aria-hidden, so screenreader users cannot access the visible buttons

Images:
image
(red area is aria-hidden, even though seeing users can interact with it)

image
(when scrolled, buttons are accessible for everyone, including screenreader users)

Expected Behavior

Given

  • ion-header with collapse="condense"
  • buttons inside first ion-header (but not in second ion-header)

When

  • user has not scrolled yet

Then (Desired)

  • buttons are rendered, interactive, and accessible by screenreader (expected because they are currently accessible for seeing users)
    Or generalized: All elements that only appear in the first header should never be aria-hidden.

Then (Alternative)

  • buttons in the condensed header are not rendered, and therefore not clickable, by no one, including screenreader users

Steps to Reproduce

See stackblitz

<ion-header mode="ios">
    <ion-toolbar mode="ios">
        <ion-buttons slot="start">
            <ion-button>Back</ion-button>
        </ion-buttons>

        <ion-title>Title</ion-title>

        <ion-buttons slot="end">
            <ion-button>Settings</ion-button>
        </ion-buttons>
    </ion-toolbar>
</ion-header>

<ion-content>
    <ion-header collapse="condense" mode="ios">
        <ion-toolbar mode="ios">
            <h1>Title</h1>
        </ion-toolbar>
    </ion-header>

    <p>Scroll to make aria work again.</p>
    <div style="height: 150vh;"></div>
</ion-content>

Steps:

  1. Immediately observe screenreader not being able to detect the back button and the settings button
  2. Scroll down
  3. Observe screenreader now being able to detect all buttons

Code Reproduction URL

https://stackblitz.com/edit/ionic6-angular14-p5ym3p?file=src%2Fapp%2Fapp.component.html

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\Users\JohannesVollmer\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 7.8.2
@angular-devkit/build-angular : 17.3.2
@angular-devkit/schematics : 17.3.2
@angular/cli : 17.3.2
@ionic/angular-toolkit : 11.0.1

Capacitor:

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

Utility:

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

System:

NodeJS : v18.16.1 (C:\Program Files\nodejs\node.exe)
npm : 9.5.1
OS : Windows 10

Additional Information

As a workaround, we copied the buttons from the first ion-header in into the second ion-header but set them to .screen-reader-only. This is not a good solution, as the buttons cannot be clicked directly (only accessible by skipping through the list). This is also a problem because the screenreader no longer matches what the seeing users see.

@ionitron-bot ionitron-bot bot added the triage label Apr 17, 2024
@johannesvollmer johannesvollmer changed the title bug: buttons inside ion-header is aria-hidden not accessible with screenreader (unless any scrolling was done) bug: buttons inside ion-header not accessible with screenreader (unless any scrolling was done) Apr 17, 2024
@johannesvollmer johannesvollmer changed the title bug: buttons inside ion-header not accessible with screenreader (unless any scrolling was done) bug: buttons inside ion-header not accessible with screenreader (unless scrolled down) Apr 17, 2024
@johannesvollmer
Copy link
Author

johannesvollmer commented Apr 17, 2024

The unexpected behaviour was the discrepancy between what seeing users have versus what screenreader are allowed to see.

the header will be invisible to both, but the buttons will be visible for seeing users only. both should match. either hide the buttons for all users, or show the buttons for all users.

@thetaPC thetaPC added the needs: investigation This issue is waiting on more investigation from the Ionic Team. label Apr 29, 2024
@ionitron-bot ionitron-bot bot removed the triage label Apr 29, 2024
@thetaPC
Copy link
Contributor

thetaPC commented Apr 30, 2024

Thank you for submitting the issue!

I was able to verify that the buttons are not accessible. This behavior does not follow the native iOS as it allows the buttons to be accessed (used the Mail app). We'll work on fixing this issue.

@thetaPC thetaPC added package: core @ionic/core package type: bug a confirmed bug report and removed needs: investigation This issue is waiting on more investigation from the Ionic Team. labels Apr 30, 2024
@thetaPC thetaPC removed their assignment Apr 30, 2024
@johannesvollmer
Copy link
Author

Awesome, thanks! :)

github-merge-queue bot pushed a commit that referenced this issue Nov 21, 2024
…30027)

Issue number: resolves #29347 

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Focusable elements like buttons cannot be accessed within the
`ion-header` when it's collapsed. They're only accessible once the small
title is displayed.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Moved the `aria-hidden` from the header to `ion-title`, this aligns
with native.
- Updated existing test.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev build: `8.4.1-dev.11732064156.12837790`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants