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 data-focus updating when exit is blocked #41

Merged
merged 2 commits into from
Jan 29, 2024
Merged

Conversation

Murreey
Copy link
Contributor

@Murreey Murreey commented Jan 26, 2024

Description

Refactoring how data-focus is applied again. Previous fix in #38 still wasn't quite right, as it changed the attributes before the blocked exit checks happen.

  • Moved the storing of the element we're leaving higher up
    • Mostly for clarity and to decouple it from bestCandidate logic
    • Also now checks that elem is actually a focusable, so it doesn't store IDs of containers or potentially any element that's been passed in
  • Moved the updating of the candidate container to after the between-container movement logic has happened
    • Doesn't have to worry about overwriting the old value before it's needed
    • Happens after data-block-exit has been checked

Motivation and Context

Fixes a bug where if movement into a new container is blocked by data-block-exit, it still gets its data-focus modified to the candidate that it was going to try to move to. The focus should only update when it actually moves.

How Has This Been Tested?

Existing data-focus tests still pass, added a new test for this specific behaviour. Checked that it fails on master, passes on this branch.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Murreey Murreey requested a review from a team as a code owner January 26, 2024 16:35
@Murreey Murreey merged commit c40fb1f into master Jan 29, 2024
1 check passed
@Murreey Murreey deleted the fix-blocked-data-focus branch January 29, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants