-
Notifications
You must be signed in to change notification settings - Fork 841
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
[EuiComboBox] Allow options to have a unique key #4048
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
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.
The approach looks good to me, and I was unable to break it. Added a couple small requests/thoughts.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
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.
Changes LGTM; pulled & tested existing examples & the new one locally
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.
Thanks the PR and the documentation example! Gots a couple of comments.
@@ -199,13 +203,15 @@ export const ComboBoxExample = { | |||
|
|||
<EuiSpacer /> | |||
|
|||
<EuiCallOut title="No duplicate option labels allowed" color="warning"> | |||
<EuiCallOut title="Duplicate labels require an id" color="warning"> |
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.
Let's actually remove this entire callout now that we have a specific example section that explains this more succinctly.
}; | ||
|
||
return ( | ||
/* DisplayToggles wrapper for Docs only */ |
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.
Remove this comment as it doesn't apply here.
/* DisplayToggles wrapper for Docs only */ |
import DuplicateOptions from './combo_box_duplicates'; | ||
const duplicateOptionsSource = require('!!raw-loader!./combo_box_duplicates'); | ||
const duplicateOptionsHtml = renderToHtml(DuplicateOptions); | ||
|
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
</p> | ||
), | ||
props: { EuiComboBox }, | ||
demo: <DuplicateOptions />, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Co-authored-by: Caroline Horn <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
Talked with Tim, it is likely that #4072 introduces a new location this change around |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
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.
Changing id
to key
solves my concerns. Thanks!
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.
Changes look even better now :) Pulled & tested locally.
Jenkins test this (unrelated CI issue) |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
* Allow options in combo box to have an id * Change warning in documentation * Fix eslint error * Added changelog entry * Address review * Update src-docs/src/views/combo_box/combo_box_example.js Co-authored-by: Caroline Horn <[email protected]> * Address review feedback * Rename id to key * Address recently merged PRs changes Co-authored-by: Caroline Horn <[email protected]>
Summary
Fixes #3803
This will allow
EuiComboBoxItems
to optionally have anid
and in this case allow duplicate labels. We require this change for Kibana, to allow displaydisplayName
of fields instead of the real name, which in some cases could be duplicate.I added a documentation section, that also states that this is not recommended to use duplicate labels.
@chandlerprall It would be great if you could check if I've forgot any place to make this work. It seems to work exactly as I want, and I tried to go through all combo box code, but a second pair of eyes would be really appreciated.
Checklist
[ ] Check against all themes for compatibility in both light and dark modes[ ] Checked in mobile[ ] Checked in Chrome, Safari, Edge, and Firefox[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes