Skip to content

fix: Add data-selected attribute to cardPrimary and cardHorizontal - #1292

Open
andrewgrano wants to merge 2 commits into
ClickHouse:mainfrom
andrewgrano:fix/350
Open

andrewgrano wants to merge 2 commits into
ClickHouse:mainfrom
andrewgrano:fix/350

Conversation

@andrewgrano

@andrewgrano andrewgrano commented Nov 4, 2026 •

Copy link
Copy Markdown

Description

  • Adds data-selected attribute to cardPrimary and cardHorizontal, reflecting the isSelected prop
  • This gives tests and consumers a stable way to check selected state without relying on generated class names
  • Adds tests for both components covering the selected and unselected states

Links and tickets

Fixes issue #350

Checklist

  • Breaking changes? No
  • Visual changes? No
  • Design review needed? No

Contribution

  • Sufficient research before PR
  • Self-reviewed the PR
  • Manually tested the changes (when applies - visual confirmation in Storybook)
  • build and build-storybook work locally
  • Tests and Stories are aligned with the changes

Note

Low Risk
Small DOM attribute and test additions with no auth, data, or behavioral logic changes.

Overview
Adds a stable data-selected attribute on the root wrapper of CardPrimary and CardHorizontal, set from the existing isSelected prop as string "true" or "false" via Boolean(isSelected).

Selection styling still comes from the existing variant classes; the new attribute is for tests and consumers that need to assert selected state without depending on generated CSS module class names. Unit tests cover both selected and unselected cases for each component.

Reviewed by Cursor Bugbot for commit 72515f7. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 72515f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@andrewgrano andrewgrano changed the title Add data-selected attribute to cardPrimary and cardHorizontal Fix(Card): expose selected state via data-selected attribute Nov 4, 2026
@andrewgrano andrewgrano changed the title Fix(Card): expose selected state via data-selected attribute Fix: Add data-selected attribute to cardPrimary and cardHorizontal Nov 4, 2026
@andrewgrano andrewgrano changed the title Fix: Add data-selected attribute to cardPrimary and cardHorizontal fix: Add data-selected attribute to cardPrimary and cardHorizontal Nov 4, 2026
@workflow-authentication-public

Copy link
Copy Markdown
Contributor

Chromatic Storybook

Check Status Link
Storybook ✅ 670 stories published Open Storybook
UI Tests ✅ 670 tests unchanged Open build

Built from commit: 64d0b734719c60d7fabce9781ccef30964c2517b · Chromatic run

Statuses as of the end of the run. The build link shows the live review state.

@XOP XOP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please check the note,
some tests and formatting require minor updates

<div
tabIndex={disabled ? -1 : 0}
aria-disabled={disabled}
data-selected={Boolean(isSelected)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please use the following pattern:
data-selected={isSelected || undefined}

similar in other card

@XOP XOP added enhancement New feature or request good first issue Good for newcomers labels Nov 5, 2026
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Andrew Ycode seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

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

Labels

enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants