Susegad UI Accessibility GitHub

How this site looks

The view settings need JavaScript. Every page reads well without them.

Mood

The same pages, in three moods.

Theme

Components

Event list

A calendar of event cards that keeps itself honest: what is coming up is on top, soonest first; what has happened is put away in a closed "Before" drawer (a native details element); and when nothing is coming it says so in words, with your call to action beside it.

quiet warm playful

Open the live demo npx @susegad/cli add event-list

Stands on: Core, Core: arrivals, Core: components, Event card, Tokens

The prompt

the prompt

A calendar for anyone who runs workshops, classes, pop-ups or suppers: a link-in-bio that should say what is on, and say plainly when nothing is.

A list of event cards that keeps itself in order. What is still to come is on top, soonest first. What has happened is put away in a closed "Before" drawer. When nothing is coming it says so and offers a way to ask.

<link rel="stylesheet" href="susegad/components/event-card/event-card.css">
<link rel="stylesheet" href="susegad/components/event-list/event-list.css">
<script type="module" src="susegad/components/event-card/event-card.js"></script>
<script type="module" src="susegad/components/event-list/event-list.js"></script>

<sg-event-list>
  <h2>What's on</h2>
  <sg-event-card start="2026-10-09T19:30" end="2026-10-09T22:00" kind="supper-club">…</sg-event-card>
  <sg-event-card start="2026-10-04T11:00" end="2026-10-04T13:00" kind="workshop">…</sg-event-card>
  <p class="sg-event-ask"><a href="https://wa.me/919800000000?text=…">Ask about a private session</a></p>
</sg-event-list>

The prompt

Make an event list web component that holds <sg-event-card> elements and keeps the calendar honest. Read each card's start, end and timezone, and the clock, and put the cards that are still to come in one list, soonest first (cards with the same start keep the order they were written in, and a card with no readable date goes last), and the cards that have happened in a native <details> called "Before", closed, labelled with how many ("Before (2)"), most recent first. Do not show the drawer when there is nothing in it. When nothing is to come, show a plain line ("Nothing on the calendar right now. Ask about a private session.", or the author's own .sg-event-empty) and the author's call to action (.sg-event-ask), and show neither otherwise. While the page is open, move a card the moment the clock passes its end, from one timer for the whole list, set for the next moment any card changes, that runs only while the list is on screen and catches up when it is seen again. A drawer the visitor opened stays open. Mark the lists as lists for a screen reader. Without JavaScript the cards simply stack in the order written. Give it three registers: quiet is a plain ruled list with a ruled "Before" row; warm draws the empty state as a dashed ticket with nothing printed on it yet; playful sets the empty line in the hand. Nothing moves except a card changing place.

Words to code

When you sayTechniqueWhat happens
soonest first, the past put awaypure coreplanList(items, now) calls partitionEvents: upcoming by start with ties kept in written order, past most recent first.
a closed "Before" archivenative firstA <details> with a <summary>: closed by default, Tab and Enter and Space work, and its contents are not visible or focusable while closed.
a real empty statehonestyplan.empty shows .sg-event-empty (your words, or the default) and .sg-event-ask, and hides the list. Both stay hidden until the element has looked at the clock, so a page with no JavaScript never says "nothing on" while events are listed.
moves a card the moment the clock passes itone timernextChangeOf(items, now) is the soonest boundary of any card; setTimeout is set for it only while the list is visible; coming back on screen runs sync() at once.
the visitor opened the drawerstate keptRe-sorting moves the cards only if their order changed, and never rebuilds the <details>, so open survives.
the list keeps the clockone clockCards inside a list ask the list for the time (list.clock()), so one now attribute fixes the whole calendar and the cards do not run timers of their own.

Accessibility

  • A real list: role="list" on the container, role="listitem" on each card.
  • The drawer is a native <details>: keyboard and screen reader support come with it.
  • The empty line is text in the page, not a picture.
  • Cards moving between the list and the drawer keep their own state and focus order.

<sg-event-list> holds <sg-event-card> elements and keeps the calendar in order. It needs event-card beside it: the clock work is the card's.

Markup

ElementWhat it is
a headingthe list's own heading ("What's on")
<sg-event-card>the events, in any order
p.sg-event-emptyoptional: what to say when nothing is coming. If you write none, the list adds "Nothing on the calendar right now. Ask about a private session."
p.sg-event-askoptional: your call to action for an empty calendar (a WhatsApp link, usually). Without JavaScript it is always shown, so put it after the cards.

The element adds div.sg-event-upcoming (the cards still to come) and details.sg-event-before (the drawer, with a summary such as "Before (2)" and div.sg-event-past).

Attributes

AttributeValuesDefault
nowan ISO time to count from, for demos and tests; it stops the clockthe real clock
timezonean IANA zone, the default for cards that name noneAsia/Kolkata
registerquiet, warm, playfulinherited

Event: sg-event-list-change { upcoming, past }, when a card moves. list.sync() reads the clock again; list.clock() is the time the list counts from.

How it keeps the calendar honest

  • Upcoming events are sorted by start, soonest first. Events that start at the same time keep the order you wrote them in. An event whose date cannot be read goes last.
  • An event moves to "Before" the moment its end passes (the end is not inclusive). With no end it moves when its day is over.
  • "Before" is closed until the visitor opens it, shows how many it holds, lists the most recent first, and is not there at all when it would be empty.
  • When nothing is coming, .sg-event-empty and .sg-event-ask show and the list hides. While anything is coming they stay hidden.
  • One timer for the whole list, set for the next moment any card changes, only while the list is on screen. Scroll back to it and it catches up at once.
  • The cards inside a list do not run timers of their own.

On a static site, call partitionEvents() from event-card/event.core.js at build time to write the cards in the right order, so a reader without JavaScript sees the same calendar.

Registers

Look
quieta plain list, a ruled "Before" row, an outlined ask link
warmthe empty state is a dashed ticket with nothing printed on it yet
playfulthe empty line and the heading in the hand

Nothing moves except a card changing place.

Accessibility

How this component meets WCAG 2.2 level A and AA, criterion by criterion, how each was checked, and what your page still owns.

  • Meets 15
  • Meets with author's part 2
CriterionStatusHow it was checked
1.1.1 Non-text contentMeetsThe list adds no images of its own. The cards inside it carry their own art as aria-hidden drawings (see the event card's table). The empty state is text (packages/components/event-list/event-list.check.mjs: "the default words show").
1.3.1 Info and relationshipsMeetsevent-list.check.mjs: "the cards are a list for a screen reader (role list, role listitem)", the past events sit in a native <details> labelled "Before (1)", and with JavaScript off "every card shows in the order written, with its heading".
1.4.1 Use of colorMeetsPast and upcoming are told apart by place and words: what has happened is in the "Before" drawer, and its label says how many. No state is carried by colour alone (event-list.check.mjs: "what has happened is in a "Before" drawer, labelled with how many").
1.4.3 Contrast (minimum)Meetsevent-list.check.mjs: "axe, light, all three registers: 0 violations" and the same in dark, and "axe with every "Before" drawer open (dark, warm): 0 violations", color-contrast included. Text roles are tested at 4.5:1 on every surface in packages/tokens/tokens.test.js.
1.4.4 Resize textMeetsManual test, 2026-10-07: the demo with the root font size at 200 percent in three registers (1280 px wide), no sideways scroll and no clipped text (throwaway Playwright script).
1.4.10 ReflowMeetsevent-list.check.mjs: "at 390 px the demo does not scroll sideways". Manual test at 320 CSS px, three registers, 2026-10-07: no sideways scroll, no element past the viewport.
1.4.11 Non-text contrastMeetsThe only parts of the list itself that need contrast are the "Before" drawer's marker (text colour) and the focus ring (--sg-focus), tested 3:1 or more on every surface for every palette and theme in packages/tokens/tokens.test.js. Card parts are covered in the event card's table.
1.4.12 Text spacingMeetsManual test, 2026-10-07: the WCAG text-spacing values (line height 1.5, letter 0.12em, word 0.16em, paragraph spacing 2em) injected on the demo in three registers, no clipped or overlapping text (throwaway Playwright script). No check in the repository asserts it yet.
2.1.1 KeyboardMeetsevent-list.check.mjs: "Tab reaches "Before" (N presses) with a focus ring; Enter opens it and Space closes it", and "the keyboard reaches the call to action in the empty state". The list itself is not a control.
2.1.2 No keyboard trapMeetsManual test: packages/components/event-list/event-list.js binds no key handler; the drawer is a native <details> and the links are native, so Tab and Shift+Tab pass through.
2.4.3 Focus orderMeetsCards and the drawer follow the order the list writes them (soonest first, then "Before"); event-list.check.mjs Tabs to the drawer and to the empty-state call to action. When a card moves into the drawer on its own, focus is not moved by the list (event-list.js calls no focus()).
2.4.4 Link purpose (in context)Meets with author's partThe list writes no link of its own. The links are the cards' (see the event card's table) and the call to action in the empty state, which is the author's markup (packages/components/event-list/event-list.check.mjs: "the keyboard reaches the call to action in the empty state"). Each link sits in a card named by its heading, which is its context. Whether the link text says where it goes is the author's.
2.4.7 Focus visibleMeetsevent-list.check.mjs: "Tab reaches "Before" ... with a focus ring"; the rule is in packages/components/event-list/event-list.css.
2.4.11 Focus not obscured (minimum)Meets with author's partManual test: packages/components/event-list/event-list.css has no position: fixed or sticky. A sticky header or banner the page adds can cover a focused card link or the drawer.
2.5.3 Label in nameMeetsThe drawer's name is its visible summary text, "Before (N)", because the list sets no aria-label on it (packages/components/event-list/event-list.js). Link names are the cards' own text.
2.5.8 Target size (minimum)MeetsManual test, 2026-10-07: no focusable control under 24 by 24 CSS px at 1280 px or at 390 px with touch, in all three registers, with the "Before" drawer closed (throwaway Playwright script).
4.1.2 Name, role, valueMeetsNative <details> for the drawer, role="list" and role="listitem" for the cards. event-list.check.mjs: axe with 0 violations in light and dark, with the drawer open, and with JavaScript off.

The page author owns:

  • The words of every card and of the empty state, in the language of the page, and lang on a card in another language (3.1.2).
  • The heading level inside each card, so the list fits the page's outline.
  • Sticky headers or banners that could cover a focused link or the drawer (2.4.11).
  • The colours the page sets behind the list, if it overrides the tokens.
  • Link texts that say where they go, in the cards and in the empty state (2.4.4).

How it behaves

  • role="list" and role="listitem" on the lists and cards.
  • The drawer is a native <details>: Tab reaches it, Enter and Space open and close it, and what is inside is neither visible nor focusable while it is closed.
  • The empty state is text.

All 57 tables, and how the library tests

Arriving and pressing

  • Cards arrive once, on the tala: each one lands on its own beat of the sixteen-beat teental cycle (130 ms a beat, nothing on the three silent beats). Only the first five wait for a beat; the rest take the fifth's beat, so the list cascades top to bottom and the longest wait is 520 ms however long it is, and the cards are in the accessibility tree from the start (the fade is visual only). The stagger is CSS, with sibling-index(); where a browser lacks it, core/arrive.js hands each one the same delay. Warm eases in; playful settles on the spring. Quiet gets no stagger, and nothing moves under reduced motion.
  • The cards put away in the closed "Before" drawer do not stagger; only what is on top does.
  • Only arrivals play. A new one that is added later starts again from the first beat, and a sort or a move the reader asked for never replays anything (data-seen marks what has arrived).
  • A press answers within a frame: no transition on the way in, and it eases back in under 150 ms. Quiet settles 1 px, warm shades the colour toward the ink, playful gives a little (scale 0.97) and lets go on the spring. Reduced motion keeps the colour and drops the movement; a held key does not move anything.