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
50.47k stars 13.53k forks source link

fix(input): clear button can be navigated using screen reader #29366

Closed liamdebeasi closed 3 weeks ago

liamdebeasi commented 3 weeks ago

Issue number: resolves #29358


What is the current behavior?

When the clear button is focused, focusin is dispatched and bubbles up to the ion-input. Our scroll assist utility listens for focusin to adjust the scroll position. It also causes the input to be re-focused. As a result, when swiping to the clear button with a screen reader, focus will be forcibly moved back to the input. This means that users cannot swipe away from the input to the right when using a screen reader.

What is the new behavior?

Adding stopPropagation was easy enough, but it turned out that the scroll assist listeners were all configured to listen during the capture phase instead of the bubble phase. As a result, stopPropgation had no effect because the scroll assist callback had already fired. To address this, I updated the listeners to listen during the bubbling phase instead of the capture phase. Based on my testing the capture phase was not required for scroll assist to work, so it appears safe to remove.

Does this introduce a breaking change?

Other information

Dev build: 8.0.1-dev.11713535425.1a4afba3

Reviewers: Please test this on a physical iOS device and be sure to test the scroll assist behavior. There is a test at http://localhost:3333/src/utils/input-shims/hacks/test you can use.

vercel[bot] commented 3 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 2:12pm