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

feat: add experimental transition focus manager #29400

Merged
merged 28 commits into from May 1, 2024
Merged

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Apr 25, 2024

Issue number: resolves #23650


What is the current behavior?

In traditional native applications, navigation will inform screen readers that the view has changed. This allows screen readers to focus the correct view. In a single page app on the web, this same concept does not exist. As a result, transitioning from Page A to Page B results in screen reader focus remaining on Page A. This means that users who rely on screen readers are not informed of view changes.

Currently, developers are responsible for implementing this on their own.

What is the new behavior?

  • Introduces a new focus manager priority global config. When defined, the app developer can specify which area of the view focus should be moved to when the transition ends. The developer does this by specifying areas in order of priority which allows for fallbacks in the event that a particular UI component (such as a header) does not exist on a view.

There is some risk here by managing focus for the application. As a result, this feature is considered experimental and disabled by default. The team should collect feedback based on usage and enable it by default when they feel this feature is stable enough.

Does this introduce a breaking change?

  • Yes
  • No

Other information

⚠️ Due to the tsconfig.json change, reviewers should restart the Stencil dev server when checking out these changes locally.

Reviewers: Please test both of the test template files on physical iOS and Android device with VoiceOver and TalkBack enabled, respectively.

Docs Link: ionic-team/ionic-docs#3627

Copy link

vercel bot commented Apr 25, 2024

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 30, 2024 6:01pm

@liamdebeasi liamdebeasi changed the title Fw 2094 feat: add experimental transition focus manager Apr 25, 2024
@liamdebeasi liamdebeasi marked this pull request as ready for review April 25, 2024 17:56
@liamdebeasi liamdebeasi requested a review from a team as a code owner April 25, 2024 17:56
test('should focus heading', async ({ page }) => {
const goToPageOneButton = page.locator('page-root ion-button.page-one');
const nav = page.locator('ion-nav');
const ionNavDidChange = await (nav as any).spyOnEvent('ionNavDidChange');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to figure out why spyOnEvent does not exist on the type interface for our custom Locator, but the method does indeed exist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to cast:

import type { E2ELocator } from '@utils/test/playwright';
...
const nav = page.locator('ion-nav') as E2ELocator;

Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, worked fine on iOS and Android physical devices.

@liamdebeasi liamdebeasi merged commit 5b686ef into feature-8.1 May 1, 2024
54 checks passed
@liamdebeasi liamdebeasi deleted the FW-2094 branch May 1, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants