Skip to content

Commit ef61c8e

Browse files
committed
fix: rename input dismiss issue on blur when submit btn ref misses (#368)
1 parent e2879df commit ef61c8e

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

next-release-notes.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
<!--
2-
### Breaking Changes
3-
4-
### Features
5-
61
### Bug Fixes and Improvements
7-
8-
### Other Changes
9-
-->
2+
- Fixes an issue where not providing a submit button ref in a custom rename input renderer would prevent dismissing the input on blur (#368)

packages/blueprintjs-renderers/src/renderers.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export const renderers: TreeRenderProps = {
156156
<span className={Classes.TREE_NODE_SECONDARY_LABEL}>
157157
<Button
158158
icon="tick"
159+
ref={props.submitButtonRef}
159160
{...(props.submitButtonProps as any)}
160161
type="submit"
161162
minimal

packages/core/src/treeItem/TreeItemRenamingInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ export const TreeItemRenamingInput: React.FC<{
6868
setTitle(e.target.value);
6969
},
7070
onBlur: e => {
71-
if (e.relatedTarget !== submitButtonRef.current) {
71+
if (!e.relatedTarget || e.relatedTarget !== submitButtonRef.current) {
7272
abort();
7373
}
7474
},
75-
'aria-label': 'New item name', // TODO
75+
'aria-label': 'New item name',
7676
tabIndex: 0,
7777
};
7878

0 commit comments

Comments
 (0)