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

fix(paginator): fix focus management to properly account for state updates while the element is already focused #415

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

DRiFTy17
Copy link
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added/updated: Y
  • Docs have been added/updated: N
  • Does this PR introduce a breaking change? N
  • I have linked any related GitHub issues to be closed when this PR is merged? N

Describe the new behavior?

The paginator will now manage its internal focus state in the following scenarios:

  1. When state is updated that causes a button to get disabled, but only while the element is focused
  2. In response to user interaction with one of the buttons that causes the button to be disabled upon clicking (again only while the field already has focus)
  3. In response to a user interaction, but the state is changed from the change event listener. This is the same as the first scenario, but the order of operations is different (and this is a common use case that we now test for)

The goal is to now ensure that we only move focus from the component if it already has focus at that time. This ensures that we allow for both user actions and programmatic state changes to move focus the same way, but it's more clear when this can happen now.

Additionally, a new focus() override method was provided that allows for programmatically focusing the paginator element because this was missing functionality before, and is standard for interactive HTML elements.

Additional information

@DRiFTy17 DRiFTy17 added the patch Increment the patch version when merged label Oct 23, 2023
@DRiFTy17 DRiFTy17 requested a review from a team as a code owner October 23, 2023 14:11
@stackblitz
Copy link

stackblitz bot commented Oct 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@DRiFTy17 DRiFTy17 merged commit 03b92ab into main Oct 27, 2023
8 checks passed
@DRiFTy17 DRiFTy17 deleted the fix/paginator-focus branch October 27, 2023 19:01
@github-actions github-actions bot added the released This issue/pull request has been released. label Oct 27, 2023
Copy link
Contributor

🚀 PR was released in v3.0.0-next.13 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged prerelease This change relates to a prerelease. released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants