Skip to content

feat: add implementationStatus badge (Baseline browser availability)#5174

Open
marcoscaceres wants to merge 2 commits intomainfrom
baseline-badge
Open

feat: add implementationStatus badge (Baseline browser availability)#5174
marcoscaceres wants to merge 2 commits intomainfrom
baseline-badge

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

@marcoscaceres marcoscaceres commented Apr 12, 2026

Summary

Adds a new implementationStatus config option that shows a Baseline browser availability badge in the spec front matter, driven by web-features data.

This addresses the W3C TAG's request that specs signal their implementation status to developers "at a glance" (w3ctag/design-reviews#1187). By building this into ReSpec, every spec gets data-driven implementation status automatically, rather than requiring manual editorial text per spec.

Screenshot 2026-04-13 at 10 49 54 AM

Configuration

// Auto-detect from edDraftURI / shortName
respecConfig.implementationStatus = true;

// Explicit web-features ID
respecConfig.implementationStatus = "grid";

// Full options
respecConfig.implementationStatus = {
  feature: "grid",
  removeOnSave: true,
  apiURL: "https://custom-endpoint/data.json",
};

What it renders

A <dt>/<dd> pair in the front matter showing:

  • Status text + official Baseline icon ("Widely available", "Newly available", or "Limited availability")
  • Browser icons grouped by engine (Chromium, Gecko, WebKit) with official support indicator SVGs
  • "More info" link to webstatus.dev

Features

  • Auto-detects features by matching spec URLs against web-features data
  • Groups browsers by engine in coloured pills (green = supported, orange = unsupported)
  • Aggregates multi-feature specs using worst-of semantics
  • removeOnSave collapses to a static link
  • Dark mode and print support
  • Uses official SVG icons from web-platform-dx/baseline-status

Files

  • src/core/implementation-status.js — new module
  • src/styles/implementation-status.css.js — styling
  • profiles/w3c.js — registered in pipeline
  • examples/baseline.html — demo (try different feature IDs)
  • tests/spec/core/implementation-status-spec.js — 9 tests
  • tests/data/baseline/data.json — test fixtures

Future work

  • May deprecate caniuse module (this subsumes its purpose)
  • Could add a respec-web-services endpoint for faster lookups
  • Bikeshed equivalent

Test plan

  • 9 unit tests passing (Chrome Headless)
  • Full test suite (Chrome + Firefox)
  • Visual review of all three statuses (limited, newly, widely)

@marcoscaceres marcoscaceres force-pushed the baseline-badge branch 6 times, most recently from 6492196 to 449ed44 Compare April 13, 2026 00:37
@marcoscaceres marcoscaceres marked this pull request as ready for review April 13, 2026 00:53
@marcoscaceres marcoscaceres requested a review from Copilot April 13, 2026 00:53
Copy link
Copy Markdown
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

Adds a new implementationStatus feature to ReSpec’s W3C profile that fetches Baseline availability data from web-features and renders an “implementation status” badge + browser support indicators in the document front matter.

Changes:

  • Introduces core/implementation-status module to fetch web-features data, auto-detect relevant features, aggregate status, and render a badge in the .head dl.
  • Adds dedicated styling for the badge/UI elements.
  • Adds unit tests + local fixtures and an example document to demonstrate configuration.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/core/implementation-status.js New core module that fetches Baseline data, resolves features, aggregates status/support, renders badge, and supports removeOnSave.
src/styles/implementation-status.css.js New CSS for badge layout, dark mode, and print behavior.
profiles/w3c.js Registers the new module in the W3C processing pipeline.
tests/spec/core/implementation-status-spec.js Adds unit tests for rendering, auto-detection, aggregation, and config normalization.
tests/data/baseline/data.json Adds test fixtures for Baseline/web-features-like data.
examples/baseline.html Adds a runnable example demonstrating the new configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +17 to +22
const ENGINES = new Map([
["chrome", "Chrome"],
["edge", "Edge"],
["firefox", "Firefox"],
["safari", "Safari"],
]);
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

ENGINES is keyed by browser IDs (chrome/edge/firefox/safari) and maps to browser names, not engine names. Renaming this (e.g., to BROWSERS/BROWSER_NAMES) and updating related identifiers (like ENGINE_GROUPS.engines) would make the intent clearer and reduce confusion for future maintainers.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agree... this should be BROWSERS

Copy link
Copy Markdown
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

New module that shows a Baseline browser availability badge in the spec
front matter (e.g. "Limited availability [icon]:"), driven by web-features
data from web-platform-dx.

Config: `respecConfig.implementationStatus` accepts `true` (auto-detect
from spec URLs), a feature ID string, or an options object.

Features:
- Auto-detects features by matching spec URLs against web-features data
- Shows browser icons grouped by engine in rounded pills
- Uses official Baseline SVG icons from web-platform-dx/baseline-status
- Uses official support indicator SVGs (check/x with arc)
- Aggregates multi-feature specs using worst-of semantics
- removeOnSave collapses to a static link
- Dark mode and print support
Copy link
Copy Markdown
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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