Skip to content

fix(src): render category headers as grid rows - #5

Merged
aqandrew merged 8 commits into
mainfrom
fix/category-header-rows
Nov 18, 2026
Merged

aqandrew merged 8 commits into
mainfrom
fix/category-header-rows

Conversation

@aqandrew

Copy link
Copy Markdown
Collaborator

Category headers in EmojiPicker.List render inside role="grid" but are not rows. So a heading inside a custom CategoryHeader fails axe aria-required-children, and every header comes after all the emoji rows in the DOM, which puts it out of reading order. coder/coder needs these headings as h2s (DEQ-130, WCAG 1.3.1).

  • Each category wrapper is a row with an aria-rowindex, and its header is a gridcell.
  • aria-rowcount and the emoji rows' aria-rowindex count the header rows.
  • Each category renders right before its first emoji row. zIndex: 1 on the category keeps the sticky headers painted above the rows, which now follow them in the DOM.
  • The keyboard scroll lookup uses the new numbering, and returns early when the active row does not exist (an arrow key after a search with no results).
  • The browser tests now treat the first row as a header row, and the viewport-height tests count emoji rows by test ID.

Arrow keys still move only between emojis, because header rows have no emoji cells. Screen reader users reach the headings with heading navigation.

coder/coder#32189 shipped this as a pnpm patch on the minified bundle. In Storybook, that patch was axe-clean and pixel-identical to the unpatched picker. This PR ports it to the source. Once released as 0.4.2, a coder/coder PR bumps to it and replaces #32189.

The jsdom tests pass, and the browser tests pass except isEmojiSupported, which fails locally without this change because the workspace has no emoji font.

🤖 Generated by Coder Agents on behalf of @aqandrew.

Category headers rendered inside role="grid" were not rows, so a heading
inside a custom CategoryHeader failed aria-required-children, and every
header came after all emoji rows in the DOM.

- Each category is a row (with aria-rowindex) and its header a gridcell.
- aria-rowcount and emoji row indices count header rows.
- Each category renders before its first row, so headers follow reading
  order; zIndex keeps sticky headers above the rows.
- The keyboard scroll lookup uses the new numbering and returns early
  when the active row does not exist (empty search results).
@aqandrew
aqandrew marked this pull request as ready for review November 16, 2026 23:42
@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

DEQ-130

Comment thread src/components/emoji-picker.tsx Resolved
Comment thread src/components/emoji-picker.tsx Resolved

@Jesswinters Jesswinters left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. The ARIA structure (header rows plus aria-rowcount/aria-rowindex that count them), the reading-order fix, and the early return in the keyboard scroll lookup all look correct, and I didn't find any blocking issues. I left two non-blocking readability suggestions: one for the row list Jeremy flagged, and one to centralize the row-index offsets.

🤖 Generated by Coder Agents on behalf of @Jesswinters.

Comment thread src/components/emoji-picker.tsx Resolved
Comment thread src/store.ts Resolved
Iterate categories instead of rows: each category renders its header,
then the spacer when its first row is visible, then its visible rows.
This gives the same DOM order without the before/visible/after lists,
the category() helper, or the per-row indexOf.
getEmojiRowAriaIndex is the one place that counts header rows. Emoji
rows, category header rows (the row just before a category's first emoji
row) and the keyboard scroll lookup all use it.

@Jesswinters Jesswinters left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM! Great improvements. TIL about aria-rowindex ✌🏻

@aqandrew
aqandrew merged commit 455080b into main Nov 18, 2026
5 checks passed
aqandrew added a commit to coder/coder that referenced this pull request Nov 19, 2026
The emoji picker's category labels ("Smileys & emotion", "Food & drink",
...) look like headings but were plain text. This bumps
`@coder/frimousse` to 0.4.2, which renders category headers as grid rows
(coder/frimousse#5), and wraps each label in an `h2`. The `h2` uses the
label's existing classes, so nothing changes visually.

Closes DEQ-130. Replaces #32189, which made the same change as a pnpm
patch.

The row-numbering test now searches a term that matches two categories.
It checks each heading, every row's `aria-rowindex`, and
`aria-rowcount`.

0.4.2 was published at 2026-11-18 17:08 UTC. Until 2026-11-19 17:08 UTC,
CI installs fail pnpm's minimum release age check
(`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`). Re-run CI after that. There
is no temporary exclusion, per
#32298 (comment).

🤖 Generated by Coder Agents on behalf of @aqandrew.
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.

3 participants