[EuiComboBox] Allow options to have a unique key#4048
[EuiComboBox] Allow options to have a unique key#4048thompsongl merged 13 commits intoelastic:masterfrom
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/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4048/ |
chandlerprall
left a comment
There was a problem hiding this comment.
Changes LGTM; pulled & tested existing examples & the new one locally
cchaos
left a comment
There was a problem hiding this comment.
Thanks the PR and the documentation example! Gots a couple of comments.
| <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.
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.
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 <549577+cchaos@users.noreply.github.com>
|
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/ |
cchaos
left a comment
There was a problem hiding this comment.
Changing id to key solves my concerns. Thanks!
chandlerprall
left a comment
There was a problem hiding this comment.
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 <549577+cchaos@users.noreply.github.com> * Address review feedback * Rename id to key * Address recently merged PRs changes Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Summary
Fixes #3803
This will allow
EuiComboBoxItemsto optionally have anidand in this case allow duplicate labels. We require this change for Kibana, to allow displaydisplayNameof 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