feat(components): add ol-toast and ol-banner web components#12868
Open
lokesh wants to merge 2 commits into
Open
feat(components): add ol-toast and ol-banner web components#12868lokesh wants to merge 2 commits into
lokesh wants to merge 2 commits into
Conversation
New Lit components for the notification UI consolidation effort: - ol-toast + ol-toast-region: Sonner-style stacked toasts (shadow DOM). Bottom-center stack, slide-up enter via data-mounted, hover/focus expands the stack and pauses dismiss timers, aria-live announcements, prefers-reduced-motion support. showToast() helper accepts a string, template element, or nodes - never parses runtime strings as HTML. - ol-banner: callout-style announcement banner (light DOM, ol-button pattern) with neutral/success/warning/danger variants and outlined/plain appearances. Persistence-agnostic: fires ol-banner-dismiss; site glue in js/banner/index.js POSTs /hide_banner; templates guard rendering on the dismissal cookie. - Document shadow-vs-light DOM decision rule in web-components.md.
…e; default timeout 4000ms - resumeTimer() now no-ops while the parent ol-toast-region is expanded, so moving the pointer between toasts (mouseleave on the one being left) can't restart its timer mid-hover. Region exposes a public 'expanded' getter for this. - Remove the document-level Escape handler: it closed every open toast at once and hijacked Escape presses meant for dropdowns/inputs/dialogs. - Raise the default auto-dismiss timeout from 2500ms to 4000ms.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Part of the notification UI consolidation effort.
Feature: two new Lit web components, demoed on
/developers/designonly — no production call sites yet.ol-toast+ol-toast-region— Sonner-style stacked toasts. Bottom-center fixed stack; new toasts slide up while older ones scale back behind; hover/focus expands the stack and pauses dismiss timers.showToast()accepts a string, a<template>element, or nodes.ol-banner— callout-style announcement banner withvariant(neutral/success/warning/danger) andappearance(outlined/plain), built-in icons matching the toast treatment.Technical
static/css/components/ol-banner.css→ol-components.css, with pre-hydration placeholders to avoid layout shift). This decision rule is now documented indocs/ai/web-components.md.prefers-reduced-motionsupported). Banners intentionally have no entrance animation.ol-banneris persistence-agnostic: it only firesol-banner-dismiss. OL-specific plumbing: templates guard rendering on the dismissal cookie, and a site-level listener (js/banner/index.js) POSTs to/hide_banner(also migrated from jQuery to fetch).label-close(attribute override pattern); all content arrives translated.Testing
make lit-components css(ordocker compose exec web make lit-components css), restart web./developers/design#toast— add toasts; hover the stack to expand (timers stay paused while expanded, even when moving between toasts); checkprefers-reduced-motion./developers/design#banner— variants/appearances/custom icon; dismiss the cookie-persisted demo, reload (server no longer renders it), reset to restore.Screenshot
toast-banner.mp4
Stakeholders
@cdrini @mekarpeles