Loading workspace…

Traffic Light

Tan Li HauSvelte core team
Languages

Build a traffic light that cycles through green, yellow, and red, repeating the sequence indefinitely.

Requirements

Each light should be lit for the following durations:

  • Red light: 4000ms
  • Yellow light: 500ms
  • Green light: 3000ms

Expose the current light with an accessible label and polite live announcement, and hide the purely visual lights from assistive technology.

You are free to exercise your creativity to style the appearance of the traffic light.

Changelog

  1. Decorative lights in Vue

    The Vue solution explicitly hides the decorative lights from assistive technology. The current light is exposed through the status announcement.

  2. Current light announcements

    The prompt requires an accessible label and a polite announcement of the current light. The individual decorative lights should be hidden from assistive technology.

  3. Angular template compilation

    The Angular reference's template was corrected so the selected light can render in the workspace.