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 : [#2986] Add ref callback #2988

Merged
merged 2 commits into from
Jul 26, 2024
Merged

Conversation

Ri-Sharma
Copy link
Contributor

Fixes #2986

Changes:

  1. Added ref callback function to resolve the issue

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number.

Copy link
Collaborator

@lindapaiste lindapaiste left a comment

Choose a reason for hiding this comment

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

Overall this looks good, but I'm not sure what to do with it because we've been working on some larger changes to the tables which would overwrite this. Specifically, the RenameInput and TableWithRename in #2382. (It's been so long that I don't even remember which parts were and were not finished).

If we have this problem in the CollectionListRow then odds are that we also have it in the SketchListRow. Those components are very similar and I don't like the current system where we have to make analogous changes in both places when we see an issue like this.

Comment on lines +122 to +125
ref={(node) => {
renameInput.current = node;
handleRenameFocus();
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the ref function get executed every time that the element is mounted? Like if you open it and close it and open it again, will it get focused the second time? I think so but I'm not certain off the top of my head.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will it get focused the second time?

Yes, it will. The way it works is when the component gets mounted the ref callback is called with the input field as an parameter. And when the component gets unmounted the callback is called again with null as an parameter.

@Ri-Sharma
Copy link
Contributor Author

If we have this problem in the CollectionListRow then odds are that we also have it in the SketchListRow. Those components are very similar and I don't like the current system where we have to make analogous changes in both places when we see an issue like this.

The SketchListRow is working fine and the problem only exists with the collections. I think this is because the SketchListRow uses class components where as the CollectionListRow uses funtional component and for some reason same logic is working for the classes but not for the functions.

@raclim raclim added type:bug Area:Accessibility Category for accessibility related features and bugs labels Feb 6, 2024
@raclim raclim added Bug and removed Type:Bug labels Mar 19, 2024
Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this!

@raclim raclim merged commit 8162909 into processing:develop Jul 26, 2024
1 check passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collections Rename Input Fails to Autofocus.
3 participants