-
Notifications
You must be signed in to change notification settings - Fork 843
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
[EuiInlineEditForm] Support onCancel callback for non-controlled usage #8307
[EuiInlineEditForm] Support onCancel callback for non-controlled usage #8307
Conversation
- allow usage also when not used as controlled component since the cancel action is always present
e460ff8
to
8fa75be
Compare
I'm not sure if this is expected or reproducible on your side, but I can't actually pass the QA steps provided. I'm getting |
That's weird. No I don't see that error 🤔 These examples work fine for me:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed on another pipeline that this component's |
@weronikaolejniczak Yeah, this flaky test is known, it's not related to the changes themselves. The problem is that I haven't been able to reproduce it locally so I'm afraid this would create unrelated clutter in this PR by trying to figure out what's actually the issue. 🙈 I'd vote for checking on this separately. |
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
Summary
This PR updates the type definition for
EuiInlineEditForm
sonCancel
prop to support using it for non-controlled usage next to the already available controlled usage.When the component is in edit mode, we have two actions: "Save" and "Cancel" and currently only the "Save" action provides a callback for non-controlled usage.
Instead we should also allow
onCancel
to be always allowed considering that the action is always available too.The main purpose of the
onCancel
callback is to reset thevalue
in controlled usage, but there might be a need to useonCancel
for non-controlled usages as well to handle other side effects.Note
No functional changes have been made in this PR. The callback was already always technically available, just that the type definition prohibited its usage.
QA
EuiInlineEditTitle
defaultValue
&onCancel
does not trigger a type errorvalue
&onChange
andonCancel
does not trigger a type errorGeneral checklist
Checked in both light and dark modesChecked in mobileChecked for accessibility including keyboard-only and screenreader modesAdded documentation@default
if default values are missing) and playground togglesChecked Code Sandbox works for any docs examplesAdded or updated jest and cypress testsUpdated visual regression testsIf applicable, added the breaking change issue label (and filled out the breaking change checklist)If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)