Skip to content

Conversation

@weronikaolejniczak
Copy link
Contributor

@weronikaolejniczak weronikaolejniczak commented Jul 24, 2025

Summary

Resolve #8900

We check whether children are interactive. If no, we trigger the click event on the whole card, including the children wrapper.

Why are we making this change?

When using EuiCheckableCard with children, e.g.:

image

to select an option, user has to be more precise and click on the radio / checkbox wrapper or the label:

image

There's a consensus that the expected behavior is if there is static content, clicking on it toggles the radio / checkbox.

Impact to users

🟢 None. All users will benefit from this behavior out-of-box.

QA

Specific checklist

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer 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)

@weronikaolejniczak weronikaolejniczak self-assigned this Jul 24, 2025
@weronikaolejniczak weronikaolejniczak force-pushed the fix/8900-eui-checkable-card-card-body-is-not-a-click-target branch 2 times, most recently from d68821c to 024232f Compare July 24, 2025 17:16
@weronikaolejniczak weronikaolejniczak marked this pull request as ready for review July 24, 2025 17:19
@weronikaolejniczak weronikaolejniczak requested a review from a team as a code owner July 24, 2025 17:19
id={`${id}-details`}
className="euiCheckableCard__children"
css={childStyles}
onClick={disabled ? undefined : onChildrenClick}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the accessibility of this and I think we're good here thanks to the focusable radio input serving the same role.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkajtoch Yes, the changes don't affect accessibility because we're not adding a new focusable element. We're only making a non-interactive div clickable (which is generally recommended against but here we have the focusable input that has an accessible name).

</label>
{children && (
<div
ref={childrenEl}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this name confused me for a sec. Could we rename it to childrenWrapperEl? I prefer not to use abbreviations like el, but I'm okay with it here since it just expands on pre-existing code 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did expand on the pre-existing code and decided to go with the somethingEl naming but actually, we can change it. How would you rename them?

I also agree with childrenWrapper.


const classes = classNames('euiCheckableCard', className);

const [interactiveChildren, setInteractiveChildren] = useState<
Copy link
Member

@tkajtoch tkajtoch Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're only checking the length of the interactiveChildren array to determine the existence of at least one tabbable child, could we just store it as a binary value here (e.g., hasInteractiveChildren) and save some memory?

I wish tabbable would provide a way to check whether the passed container has any tabbable elements, so it could return on the first match and save even more here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkajtoch ah, you're absolutely right, we can store a boolean. Refactoring...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkajtoch addressed on 4eb547e, thank you for raising this, what a derp am I... 🙈

@weronikaolejniczak weronikaolejniczak force-pushed the fix/8900-eui-checkable-card-card-body-is-not-a-click-target branch from 024232f to e3b99ac Compare July 28, 2025 11:52
Copy link
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing my comments @weronikaolejniczak! 🎉 LGTM

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@weronikaolejniczak weronikaolejniczak merged commit 2cb75c6 into elastic:main Jul 28, 2025
5 checks passed
tkajtoch added a commit to elastic/kibana that referenced this pull request Aug 5, 2025
`106.1.0` ⏩ `106.2.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

### `@elastic/eui`

#### [`v106.2.0`](https://github.com/elastic/eui/releases/v106.2.0)

- Enhanced `EuiCheckableCard` to make non-interactive children clickable
for card selection ([#8907](elastic/eui#8907))
- Added `showFooter` and `toolbarProps.right` props to
`EuiMarkdownEditor` for more flexible layout control.
([#8889](elastic/eui#8889))
([#8889](elastic/eui#8889))

**Bug fixes**

- Fixed `EuiPopover` not closing on outside click after multiple fast
clicks on the trigger element
([#8882](elastic/eui#8882))

**Accessibility**

- Added accessible labels to virtualized `EuiCodeBlock`
([#8887](elastic/eui#8887))

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Marta Bondyra <[email protected]>
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
`106.1.0` ⏩ `106.2.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

### `@elastic/eui`

#### [`v106.2.0`](https://github.com/elastic/eui/releases/v106.2.0)

- Enhanced `EuiCheckableCard` to make non-interactive children clickable
for card selection ([elastic#8907](elastic/eui#8907))
- Added `showFooter` and `toolbarProps.right` props to
`EuiMarkdownEditor` for more flexible layout control.
([elastic#8889](elastic/eui#8889))
([elastic#8889](elastic/eui#8889))

**Bug fixes**

- Fixed `EuiPopover` not closing on outside click after multiple fast
clicks on the trigger element
([elastic#8882](elastic/eui#8882))

**Accessibility**

- Added accessible labels to virtualized `EuiCodeBlock`
([elastic#8887](elastic/eui#8887))

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Marta Bondyra <[email protected]>
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
`106.1.0` ⏩ `106.2.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

## Package updates

### `@elastic/eui`

#### [`v106.2.0`](https://github.com/elastic/eui/releases/v106.2.0)

- Enhanced `EuiCheckableCard` to make non-interactive children clickable
for card selection ([elastic#8907](elastic/eui#8907))
- Added `showFooter` and `toolbarProps.right` props to
`EuiMarkdownEditor` for more flexible layout control.
([elastic#8889](elastic/eui#8889))
([elastic#8889](elastic/eui#8889))

**Bug fixes**

- Fixed `EuiPopover` not closing on outside click after multiple fast
clicks on the trigger element
([elastic#8882](elastic/eui#8882))

**Accessibility**

- Added accessible labels to virtualized `EuiCodeBlock`
([elastic#8887](elastic/eui#8887))

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Marta Bondyra <[email protected]>
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.

[EuiCheckableCard] Card body is not a click target

3 participants