Skip to content

[EuiComboBox] Prevent option title from leaking to list item and keep it on text node - #9883

Closed
alexwizp with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-for-review-comment
Closed

[EuiComboBox] Prevent option title from leaking to list item and keep it on text node#9883
alexwizp with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-for-review-comment

Conversation

Copilot AI commented Aug 10, 2026

Copy link
Copy Markdown

Summary

This addresses the single review comment on PR #9850: combo box options could still place title on the option <li> via spread props, causing duplicate screen reader announcement paths. The change ensures option-level title is intercepted and applied only to the inner text element.

  • What: Updated EuiComboBoxOptionsList to strip title from option rest props before spreading onto EuiListItemLayout, then pass title via textProps only.
  • Why: Prevents accessible-description duplication caused by title on the option element while preserving consumer-provided/native truncation tooltip behavior.
  • How:
    • Code path updated
      • destructure title: optionTitle from option object
      • compute final title (consumer optionTitle first, truncation fallback second)
      • remove title prop from option <li> and set textProps={{ title }}
    • Regression coverage
      • added focused test asserting:
        • option element does not have title
        • .euiListItemLayout__text does have title
const { title: optionTitle, ...rest } = option;
const title = optionTitle ?? (hasNativeTruncation && !toolTipContent ? label : undefined);

<EuiListItemLayout
  {...rest}
  textProps={{ title }}
/>

API Changes

component / parent prop / child change description
EuiComboBox options title attribute placement Changed title is no longer allowed on option <li> via spread props; it is applied to the inner text element

Screenshots

Before After
N/A (a11y/DOM attribute placement only) N/A (a11y/DOM attribute placement only)

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — DOM-attribute assertions targeting option-level title should target the inner text element instead.
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 Low

Release Readiness

  • Documentation: N/A
  • Figma: N/A
  • Migration guide: N/A
  • Adoption plan (new features): N/A

QA instructions for reviewer

  • Open an EuiComboBox with an option that includes title.
  • Inspect rendered option (role="option") and confirm it has no title attribute.
  • Confirm .euiListItemLayout__text contains the title attribute.
  • Confirm tooltip behavior for truncated labels remains present on text hover.

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

Co-authored-by: alexwizp <20072247+alexwizp@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the code for review comment suggestion [EuiComboBox] Prevent option title from leaking to list item and keep it on text node Aug 10, 2026
Copilot AI requested a review from alexwizp August 10, 2026 13:10
@alexwizp alexwizp closed this Aug 10, 2026
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
1 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euidatagrid (1 difference)

StoryBeforeAfterDiff
compact desktop

@infra-vault-gh-plugin-prod

infra-vault-gh-plugin-prod Bot commented Aug 10, 2026

Copy link
Copy Markdown

💔 Build Failed

Failed CI Steps

History

cc @alexwizp @Copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants