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

Custom renderers prevent automatic renaming abort on outside click #368

Closed
combdn opened this issue Apr 25, 2024 · 3 comments
Closed

Custom renderers prevent automatic renaming abort on outside click #368

combdn opened this issue Apr 25, 2024 · 3 comments
Assignees

Comments

@combdn
Copy link

combdn commented Apr 25, 2024

Describe the bug
When using custom renderers, renaming seems to be automatically aborted only when I click on the other three items. If I click outside of the tree, the renaming input loses focus, but the item is still stuck in the renaming state.

To Reproduce
‘Blueprint JS Renderers’ storybook has the same issue:

CleanShot.2024-04-25.at.13.34.16.mp4

Expected behaviour
‘Single Tree’ storybook with the default renderers behaves correctly:

CleanShot.2024-04-25.at.13.47.52.mp4

Additional context
I’m using Blueprint JS renderers as a starting point, so it might be the same issue as in the storybook.

@lukasbach
Copy link
Owner

Hey @combdn, thanks for the report! The reason, why the blur-based rename aborting didn't work with the blueprintjs renderers, was because the rename-submit button required registration through a ref, so essentially this was the fix. If this ref is missing, the library can't figure out if the input-blur happened because the user clicked on the submit button, in which case we of course don't want to abort renaming.

The current default is of course not a great one, so as of 2.4.3 I've changed it to still properly abort renaming if the submit button ref was not passed (e.g. if no submit button exists). But if you do have a rename-submit button, you probably also want to add the ref to the button.

@combdn
Copy link
Author

combdn commented May 1, 2024

Thank you very much for fixing it!

BTW, I’m finding Blueprint JS renderers a great reference. I think they deserve more emphasis in the docs as such.

@combdn combdn closed this as completed May 1, 2024
@lukasbach
Copy link
Owner

Happy to hear! Good point, yeah they would probably make sense to mention in relation to how to write renderers, I'll expand that docs section.

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

No branches or pull requests

2 participants