Skip to content

Collections Rename Input Fails to Autofocus. #2986

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

Closed
Ri-Sharma opened this issue Feb 4, 2024 · 2 comments · Fixed by #2988
Closed

Collections Rename Input Fails to Autofocus. #2986

Ri-Sharma opened this issue Feb 4, 2024 · 2 comments · Fixed by #2988
Labels
Area:Accessibility Category for accessibility related features and bugs Bug Priority:Medium

Comments

@Ri-Sharma
Copy link
Contributor

Ri-Sharma commented Feb 4, 2024

Actual Behavior

When attempting to rename a collection, the input field does not automatically focus, leading to a slight inconvenience in the user experience.

Expected Behavior

Upon pressing the rename button, the input field should autofocus, similar to the behavior observed when renaming a sketch

Steps to reproduce:

  1. Navigate to a collections page.
  2. Select the rename option from the dropdown of any collection.
    (You have to manually click on the input field or click on the rename option again to focus.)
@Ri-Sharma Ri-Sharma added the Bug label Feb 4, 2024
Ri-Sharma added a commit to Ri-Sharma/p5.js-web-editor-forked that referenced this issue Feb 4, 2024
@lindapaiste
Copy link
Collaborator

Somewhat related to #2383

@lindapaiste lindapaiste added Area:Accessibility Category for accessibility related features and bugs and removed Bug labels Feb 4, 2024
@lindapaiste
Copy link
Collaborator

Ha - I removed the tag "Bug" because I was thinking that this was more of an enhancement. But then I looked at your PR and I see that we already have code which is supposed to handle the autofocus. It doesn't work so I guess it is a bug after all 🙃

It seems like the

if (renameInput.current) {
   renameInput.current.focus();
 }

is getting called too early - before the input is mounted and therefore it doesn't do anything. One fix might be to wrap that part in a setTimeout with a 0 ms delay, such that it gets executed on the next render.

@lindapaiste lindapaiste added the Bug label Feb 4, 2024
@raclim raclim added this to the MINOR Release for 2.13.0 milestone Mar 8, 2024
raclim added a commit that referenced this issue Jul 26, 2024
TUSHAR1651 pushed a commit to TUSHAR1651/p5.js-web-editor that referenced this issue Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Accessibility Category for accessibility related features and bugs Bug Priority:Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants