Timeline
The Timeline component is used to display items on a vertical Timeline, connected by Timeline elements.
Page navigation navigation
Accessibility and usability expectations
Presentation
Cognition
Timelinecontent should follow a chronological or logical order to help users mentally model the sequence of events- Avoid overloading a single item with too much information; break long descriptions into manageable chunks for easier comprehension
- Use consistent visual markers (e.g., icons, spacing) to reinforce the event structure and support pattern recognition
- If event types are differentiated by color or icon only, ensure they’re also described in text for users with cognitive disabilities
Vision
- The vertical lines connecting
timelineitems lack sufficient contrast, which may make them hard to see for users with low vision. However, because they are decorative and not required to understand the structure, they are not subject to the WCAG 3:1 contrast requirement - The text in
timelineitems must meet a minimum contrast ratio of 4.5:1 to ensure readability - Text must be resizable and zoomable without content loss or requiring horizontal scrolling, supporting users with low vision
Mobility
- Ensure all interactive elements within a
timelineitem (e.g. inline links) meet minimum touch target size of 24×24 CSS pixels
Adaptability
- Text must remain readable when resized or zoomed, and must not require horizontal scrolling, to ensure it remains accessible at narrow viewports or high zoom levels
Interaction
Keyboard
Timelineitems must not trap focus; all interactive elements inside each item must be accessible usingTabandShift+Tab- Keyboard users should be able to reach all actionable content (e.g. inline links) without encountering visual or focus loss due to scrolling
Engineering for AT Compatibility
Screen reader
GitHub timelines expose a named list so screen reader users can hear its item count and navigate between events with list-navigation commands. This makes long histories easier to understand and explore without visual scanning. See the announcement that screen readers can navigate timelines as lists. Exact position announcements vary by screen reader and browser.
- With
primer_react_timeline_list_semanticsenabled,Timelinerenders an<ol role="list">andTimeline.Itemrenders an<li>, exposing the event sequence as a list - Give the list an accessible name with
aria-labelledbypointing to its visible heading, oraria-labelwhen no heading supplies the name - Octicons used as badges should include a text alternative when they convey essential information about the message type. Even if the message type is also described in surrounding text, a text alternative helps screen reader users quickly identify relevant items without listening to full content
Speech recognition
- Ensure all interactive elements (e.g. inline links) within
timelineitems have clear and unique visible labels that match their programmatic labels
Timeline breaks
Timeline.Break visually separates content. With list semantics enabled, it
renders an empty <li role="presentation">. It does not represent an event in the
accessible list and does not need to meet non-text contrast requirements.
Keep it empty and non-interactive: role="presentation" removes list-item
semantics, but does not hide meaningful content placed inside it.
The content within Timeline.Item should clearly communicate the status and state of that item, so that if there is a need to separate content, the context of the separation is communicated in Timeline.Item.
Built-in accessibility features
- The list-semantics opt-in supplies ordered-list and list-item markup, including a presentational list item for a decorative break
- Primer text colors provide contrast against the corresponding theme backgrounds; check custom content and styles at narrow viewports and when zoomed
- The accessible name of an icon can be set by passing an
aria-labeltoOcticon
Implementation requirements
GitHub's rollout of the list-semantics flag is generally available (GA). This host
configuration does not change the Primer React package default, which remains
false. Wrap the timeline in FeatureFlags from @primer/react/experimental and
enable primer_react_timeline_list_semantics. Without the opt-in, the package
still renders non-semantic <div> elements.
- Keep
Timeline.ItemandTimeline.Breakas direct children ofTimeline. Put event content insideTimeline.Item, not in extra DOM wrappers between the list and its items - Preserve a chronological or logical event order and give the list an accessible name
- When a host application loads more events, announce the newly loaded content and manage focus without overriding a user's move elsewhere. See Loading more events
- For timestamps and event links, honor the host's time-format preference and expose the precise date and time to keyboard and screen reader users. See the timestamp recipe and RelativeTime accessibility guidance
- Keep permalink target highlighting separate from keyboard focus. The timestamp recipe reveals the event and decorates its badge; it does not make the row or badge focusable. Scrolling, target styling, and highlight lifecycle belong to the host, not to
Timeline - Give meaningful icons a text alternative with
aria-label:
import {Timeline} from '@primer/react'
import {FeatureFlags} from '@primer/react/experimental'
import {GitCommitIcon} from '@primer/octicons-react'
<FeatureFlags flags={{primer_react_timeline_list_semantics: true}}>
<Timeline aria-label="Commit history">
<Timeline.Item>
<Timeline.Badge>
<GitCommitIcon aria-label="Commit" />
</Timeline.Badge>
<Timeline.Body>Update with a long format description</Timeline.Body>
</Timeline.Item>
</Timeline>
</FeatureFlags>
Loading more events
After Load more or Load all adds events, GitHub announces the update, for example, "11 new items loaded." This count describes newly rendered event rows, not the list total or all raw events fetched. A rolled-up group counts as one row, and load-control rows do not count toward the announcement.
GitHub moves focus into newly loaded content when appropriate. If the user moves focus elsewhere during loading, the application preserves that focus and still announces the newly loaded row count.
Primer provides the semantic list markup. GitHub application code supplies loading, focus management, and live announcements. Other hosts must implement these behaviors themselves. Loading focus management is separate from the permalink recipe's badge highlight, which does not move focus to an event row.
How to test the component
Integration tests
- The rendered timeline has an accessible list name, and its events appear as list items in the intended order
- Screen readers expose the list and its events without relying on a specific announcement of item position
- Icons that are not decorative have an appropriate accessible name
- If content within the
timelineis visually separated, usingTimeline.Break, the context of the separation is communicated inTimeline.Item - Plain timestamps and timestamp links follow the host's relative or absolute preference. Precise date and time remain available as visible text for the plain timestamp and through keyboard focus for the linked timestamp
- Event permalinks reveal the correct target after keyboard activation and when users open or reload its URL. The recipe highlights the badge, not a focused row, and preserves visible keyboard focus indicators on the timestamp link
- Editing the live example does not move focus from the code editor to an event
- After Load more or Load all, the host announces the newly rendered event-row count separately from the list total, counting rolled-up groups once and excluding load-control rows
- When the user moves focus elsewhere during loading, the host preserves that focus and still announces completion; otherwise, verify that focus moves into newly loaded content when appropriate
Component tests
- With the flag enabled,
Timelinerenders<ol role="list">, eachTimeline.Itemrenders a direct<li>child, and an emptyTimeline.Breakrenders<li role="presentation"> - The text meets the colour contrast requirement of 4.5:1
- The text is resizable and can be zoomed without loss of content or requiring horizontal scrolling
- When an
aria-labelwith a value is applied toOcticon, anaria-labelwith the value is rendered on the icon SVG, and the icon is not hidden from the accessibility tree