Skip to content

feat(ADBLABS-42): grid item - #17

Open
amazingrando wants to merge 16 commits into
mainfrom
feat/grid-item
Open

feat(ADBLABS-42): grid item#17
amazingrando wants to merge 16 commits into
mainfrom
feat/grid-item

Conversation

@amazingrando

@amazingrando amazingrando commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary of changes

  • Add a new grid-item block for card-style content (category, image, title, subhead) matching the Adobe Labs Website Figma Grid component (Caption Top).
  • Decorate authored key/value tables into semantic markup with separate category and item links.
  • Support aspect-ratio block options (aspect-1/1, aspect-4/5, aspect-3/2, aspect-2/3) and an isVideo flag with a play affordance and screen-reader “Video article” label.
  • Add project category color tokens (--color-category-*) for Research, Workflows, Sneaks, and Playground swatches.
  • Harden links: known category paths only, http/https allowlist for item URLs, a11y focus styles and decorative image alt when title/subhead are present.
  • Document how to create and register blocks in DA under README “Creating blocks”.

Relevant Links

Test URLs:

Checklist

  • This PR has visual changes, and has been reviewed by a designer.
  • This PR has code changes, and our linters still pass.
  • This PR has new code, so new tests were added or updated, and they pass.
  • This PR affects production code, so it was browser tested (see below).
  • This PR has copy changes, so copy was proofread and approved.
  • The content of this PR requires documentation, so we added a detailed description of the component's purpose, requirements, quirks, and instructions for use by designers and developers. This includes accessibility information if pertinent.

Validation

  1. Make sure all PR checks have passed.
  2. Pull down the branch and run locally or view on the PR testing link.
  3. Verify the implementation against the design and story requirements.

Validation steps

  • Place a grid-item from the DA library (or paste a key/value table) on a preview page; confirm category → category path, image/title/subhead → item url.
  • Confirm aspect options: default / aspect-1/1, aspect-4/5, aspect-3/2, aspect-2/3 crop the image correctly.
  • With isVideo = true, play icon appears and screen readers announce “Video article” before the title; with false/omitted, no play UI.
  • Omitting category or subhead does not leave empty markup; unknown category names render as text (not a broken link).
  • Category swatches match Research / Workflows / Sneaks / Playground.
  • Keyboard: category and main links show a visible :focus-visible outline.
  • README “Creating blocks” steps match current DA /docs/library/ workflow.

Browser Testing

We should aim to support the latest version of the listed browsers. For older versions or other browsers not on the list, content should be accessible, even if it doesn't completely match the designs.

Developers should test as they work in the browsers available on their machines. If they have access to other devices to test other browser/OS combinations, they should do that when possible.

Windows

  • Firefox
  • Chrome
  • Edge

MacOS

  • Firefox
  • Chrome
  • Safari
  • Edge

Android

  • Firefox
  • Chrome
  • Edge

iOS

  • Safari

Authoring fields (for reviewers)

Field Notes
title Heading text
subhead Supporting line under title
url Item destination (http/https only)
category research | workflows | sneaks | playground (links to /research etc.)
image Media
alt-text Image alt; if empty and title/subhead exist, image is treated as decorative
isVideo true / false — play chip when true

Block options in the table header, e.g. grid-item (aspect-4/5).

@aem-code-sync

aem-code-sync Bot commented Aug 25, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented Aug 25, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 /drafts/grid-item-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /drafts/grid-item-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@amazingrando
amazingrando marked this pull request as ready for review August 25, 2026 14:48
@jawinn
jawinn self-requested a review August 25, 2026 15:56

@jawinn jawinn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The styles look good. On the JS and content side, we need some adjustments and refactors to make sure this is more reusable for Layout Grid and Content Grid.

Comment thread .github/PULL_REQUEST_TEMPLATE.md Outdated
Comment thread blocks/grid-item/grid-item.css
Comment thread blocks/grid-item/grid-item.css Outdated
Comment thread blocks/grid-item/grid-item.css Outdated
Comment thread blocks/grid-item/grid-item.js
Comment thread blocks/grid-item/grid-item.js Outdated
Comment thread blocks/grid-item/grid-item.js Outdated
Comment thread blocks/grid-item/grid-item.js Outdated
Comment thread blocks/grid-item/grid-item.js Outdated
Comment thread README.md
Comment on lines +59 to +71
### Make the block available to authors

Authors insert blocks from the Library in [Document Authoring](https://da.live/#/adobe/adobe-labs-website). That catalog lives in DA under `/docs/library/`, not in this repo. Code merges ship separately from content publish.

1. Open `/docs/library/blocks/` and create a document named after the block.
2. In that document, author one or more default instances (tables whose first row is the block name, plus sample content). Use section breaks between variants so Library can list them separately. This is what gets placed when an author adds the block. Preview and publish the document.
3. Open the `blocks` spreadsheet in `/docs/library/` and add a row:
- `name`: the label shown in Library → Blocks
- `path`: the content URL of the document, for example `https://content.da.live/adobe/adobe-labs-website/docs/library/blocks/<block-name>` (use `content.da.live`, not `da.live`)
4. Preview and publish the spreadsheet.

Authors can then add the block from Library → Blocks. For more on library setup, see [Setup library](https://docs.da.live/administrators/guides/setup-library).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Marissa had ADBLABS-82 to document this based on her Slack info. We can probably just move to in progress with your face on it. Any adjustments @marissahuysentruyt ?

Co-authored-by: Josh Winn <965114+jawinn@users.noreply.github.com>
Co-authored-by: Josh Winn <965114+jawinn@users.noreply.github.com>
@amazingrando amazingrando changed the title feat: grid item feat(ADBLABS-42): grid item Aug 26, 2026
@amazingrando amazingrando mentioned this pull request Aug 27, 2026
21 tasks
Comment thread blocks/grid-item/grid-item.js Outdated
Comment on lines +62 to +63
* @property {Element} [media] `<picture>` or `<img>` from AEM
* @property {string} [image] Image URL from JSON (Content Grid)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For clarity, could you rename media to mediaElement and image to imageUrl? So it's more apparent which things are text and which are elements.

Comment thread blocks/grid-item/grid-item.js Outdated
* @param {string} value Candidate URL, possibly relative
* @returns {string}
*/
function toSafeHttpUrl(value) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be in utils as well?

Comment on lines +160 to +162
export default function decorate(block) {
buildGridItem(getGridItemData(block), block);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 Thanks for refactoring with the build function.

Comment thread .github/PULL_REQUEST_TEMPLATE.md Outdated
Comment on lines 45 to 66

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This might not have been clear, but with the edit above this from the last review, the idea was to remove this entire "Testing Pages..." section.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Really close on styles. I'm seeing a couple issues:

  1. I’m looking at the grid-item-test page, and the 4/5 and 2/3 example images are not covering the whole card. I think the issue is the picture wrapper not taking up the whole space for the cover image inside.
Screenshot 2026-08-27 at 2 04 14 PM
  1. The spacing between category and card is too large compared to the design. It looks like there’s something going on with the combination of extra padding + gap + min-height.

  2. The hover/focus area for the category link is too wide; I would expect the hover should only be on the category text and badge, right now it extends the entire width of the card which feels a little weird to me.

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