Skip to content

Conversation

@leekelleher
Copy link
Member

@leekelleher leekelleher commented Jun 30, 2025

Description

Following the proposed implementation of displaying a checkbox on a Media Card in the Umbraco CMS backoffice, umbraco/Umbraco-CMS#19616, we agreed that this feature should be done natively across cards in the UUI library.

Fixes umbraco/Umbraco-CMS#18405.

Types of changes

  • New feature (non-breaking change which adds functionality)

Motivation and context

As a UX enhancement, a checkbox has been added to selectable cards to provide a visual indicator that the card can be selected, (rather than attempting to click the card's border).

How to test?

Important

Please note, the checkbox will only be available when the card is in selectable mode.
The checkbox will only appear when the card is focused (or being hovered).

In the Storybook, for a Media Card, does toggling the checkbox perform a select/deselect action? Does clicking the card's border toggle the checkbox? Does keyboard navigation work with the select/deselect interaction?

The hover-over checkbox has been added to the following card types: Block Type Card, Content Node Card, Media Card and User Card. It has not been added to the base uui-card.

Screenshots (if appropriate)

Recording.2025-06-30.185647.mp4

@leekelleher leekelleher added the feature Something we are looking to build label Jun 30, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new checkbox selection feature to various card components within the UUI library. Key changes include:

  • Adding a dependency on uui-checkbox and importing it in uui-card.
  • Implementing a renderCheckbox() method in uui-card and integrating it into the derived card components (User, Media, Content Node, and Block Type).
  • Updating the corresponding Storybook stories to demonstrate selectable card variants.

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/uui-card/tsconfig.json Added reference to uui-checkbox to enable checkbox feature.
packages/uui-card/package.json Added dependency on uui-checkbox.
packages/uui-card/lib/uui-card.element.ts Introduced renderCheckbox() and imported uui-checkbox.
packages/uui-card-user/* Integrated renderCheckbox() into card user element and updated story.
packages/uui-card-media/* Integrated renderCheckbox() and updated story; removed "width: 100%" from #content CSS.
packages/uui-card-content-node/* Integrated renderCheckbox() and updated styling for #select-checkbox.
packages/uui-card-block-type/* Integrated renderCheckbox() and updated story configuration.
Comments suppressed due to low confidence (1)

packages/uui-card-media/lib/uui-card-media.element.ts:210

  • The removal of 'width: 100%;' from the #content styling could impact layout consistency compared to other card components. Consider confirming that this change aligns with the intended design and layout behavior for media cards.
        display: flex;

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1138.westeurope.azurestaticapps.net

@nielslyngsoe
Copy link
Member

@leekelleher looks really good 👏

I have not cloned it down yet, but it seems there are 3 focusable elements. I would say that we should only have two. The question then goes, should the element that can retrieve tab-focus for selection be the checkbox or the outer frame?

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
28.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions
Copy link

github-actions bot commented Jul 8, 2025

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1138.westeurope.azurestaticapps.net

@leekelleher
Copy link
Member Author

I have not cloned it down yet, but it seems there are 3 focusable elements. I would say that we should only have two. The question then goes, should the element that can retrieve tab-focus for selection be the checkbox or the outer frame?

Good point! I think the tab-focus for selection should be on the outer frame. I've added a tabindex="-1" to the checkbox.

Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

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

Super Duper, works well, code looks good, just a very nice update to get into the system!

@nielslyngsoe nielslyngsoe merged commit d12a9e1 into main Aug 5, 2025
10 of 12 checks passed
@nielslyngsoe nielslyngsoe deleted the v1/feature/card-selection-checkbox branch August 5, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Something we are looking to build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Super Fiddily to select the first media items in a media section to perform bulk actions...

3 participants