Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Remove useEffect to Prevent Auto-Focus in AutosuggestField#53

Merged
nicholasio merged 2 commits intodevelopfrom
fix/52-remove-focus-by-default
Apr 25, 2024
Merged

Remove useEffect to Prevent Auto-Focus in AutosuggestField#53
nicholasio merged 2 commits intodevelopfrom
fix/52-remove-focus-by-default

Conversation

@dmtrmrv
Copy link
Copy Markdown
Contributor

@dmtrmrv dmtrmrv commented Apr 24, 2024

Description of the Change

The AutosuggestField component employs a lifecycle method that automatically focuses on the input when rendered. This behavior introduces an accessibility (a11y) issue. Consider the following scenario:

When AutosuggestField is positioned deep within the DOM, after the main navigation and other links, users who land on the page must navigate backwards (using Shift + Tab) to reach the main navigation. This method is non-intuitive and disrupts the functionality of skip links, which facilitate faster navigation.

Generally, manipulating focus without considering the context of surrounding components is not an advisable practice.

Closes #52

Changelog Entry

Removed the useEffect hook from the AutosuggestField

Credits

Props @dmtrmrv

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dmtrmrv dmtrmrv requested a review from nicholasio April 24, 2024 18:56
@nicholasio nicholasio merged commit 2a62468 into develop Apr 25, 2024
@nicholasio nicholasio deleted the fix/52-remove-focus-by-default branch April 25, 2024 00:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential Unexpected Focus Behavior

2 participants