Skip to content

Focus accessibility problem for screen reader and keyboard#916

Closed
AshmitSherigar wants to merge 2 commits intoprocessing:mainfrom
AshmitSherigar:fix-focus
Closed

Focus accessibility problem for screen reader and keyboard#916
AshmitSherigar wants to merge 2 commits intoprocessing:mainfrom
AshmitSherigar:fix-focus

Conversation

@AshmitSherigar
Copy link
Copy Markdown
Contributor

@AshmitSherigar AshmitSherigar commented Jul 23, 2025

What I Fixed

  • Fixed a focus issue in the search input field.
  • After submitting a search the clear button (x mark) now gets focus.
  • After clearing the search the input field is automatically focused again.
  • This improves keyboard accessibility and user flow.

How to Test

  1. Go to /Search/
  2. Go to the search bar and type something valid --> Press Enter.
  3. After results show, check if the button is focused.
  4. Click to clear --> Input field should automatically regain focus.
  5. Focus behavior should feel smooth and predictable throughout.

Files Changed

  • components/SearchResults.tsx

Let me know if there is any update for me to do

Closes #914

@AshmitSherigar
Copy link
Copy Markdown
Contributor Author

@coseeian Could you also review this PR too thanks alot

@coseeian
Copy link
Copy Markdown
Collaborator

I’ve tested the updated focus behavior in this PR, and everything works as expected. I think it’s OK.

@AshmitSherigar
Copy link
Copy Markdown
Contributor Author

Thank you

@AshmitSherigar
Copy link
Copy Markdown
Contributor Author

@coseeian could u see this code

Copy link
Copy Markdown
Member

@ksen0 ksen0 left a comment

Choose a reason for hiding this comment

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

Hi @AshmitSherigar , thank you for your work on this and sorry for the delay.

The PR contains many small changes not related to the issue (removing comments, changing if statements, removing {}), so please revert all changes that are not necessary. Functionally it works, but it is difficult to understand what has changed and verify that there are no side effects. Please edit this PR so it is more clear what has been changed. Thank you very much!

I realize it's been a little while, so if you don't respond in the next 7 days, I can go ahead and add a commit to clean it up so it can be merged.


const clearInput = () => {
if (inputRef.current) inputRef.current.value = "";
setInputEdited(false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are the main changes of this PR the addition of this line and the line below? Or something else as well?

@AshmitSherigar
Copy link
Copy Markdown
Contributor Author

@ksen0 let me look into this now give me some time

@AshmitSherigar
Copy link
Copy Markdown
Contributor Author

@ksen0 i will make a new PR since i lost the track of this .. is it fine?

@ksen0
Copy link
Copy Markdown
Member

ksen0 commented Sep 9, 2025

@AshmitSherigar Yes, that's no problem, you can close this and open another one.

@AshmitSherigar AshmitSherigar closed this by deleting the head repository Sep 11, 2025
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.

[focus] Focus is lost after clicking “Submit search” button

3 participants