question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Editable submitOnBlur submits on button click

See original GitHub issue

🐛 Bug report

Following the example from https://chakra-ui.com/docs/form/editable#with-custom-controls I would expect it to behave the same with submitOnBlur, i.e., <kbd>esc</kbd> should undo any change instead of calling onSubmit. Also, the cancel button should call onCancel instead of onSubmit.

💥 Steps to reproduce

The example linked below first calls onCancel and afterwards onSubmit but does not revert changes. If you click the cancel button, it only calls onSubmit. I understand that clicking the button does blur EditableInput, but maybe the blur should be scoped to Editable instead. How can I get the button to call onCancel otherwise?

💻 Link to reproduction

TypeScript CodeSandbox template

🌍 System information

Software Version(s)
Chakra UI 1.1.5
Browser Chrome 87.0.4280.88
Operating System macOS 11.1 (20C69)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
segunadebayocommented, Mar 19, 2021

Looking into this!

1reaction
voglercommented, Jan 28, 2021

Sorry, added above. Your setup behaves differently?

Read more comments on GitHub >

github_iconTop Results From Across the Web

X-Editable set onblur: "submit" as a default behavior
Is there a convenient way to set for all my usages of the editable function - onblur to be 'submit' and not 'cancel'...
Read more >
onBlur: 'submit' — DataTables forums
I have always had problems with inline editing and submitting values "onBlur". It worked but in some cases it didn't work.
Read more >
onblur Event - W3Schools
The onblur event occurs when an element loses focus. The onblur event is often used on input fields. The onblur event is often...
Read more >
Element: blur event - Web APIs | MDN
There are two ways of implementing event delegation for this event: by using the focusout event, or by setting the useCapture parameter of ......
Read more >
lightning-input - documentation - Salesforce Developers
Use lightning-button instead for input types button , reset , and submit . ... validated against the user's Salesforce locale format during the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found