Skip to content

feat(alerts): allow site_wide_message to carry dismissable and bgColor - #2385

Merged
thostetler merged 2 commits into
adsabs:masterfrom
thostetler:feature/configurable-site-wide-banner
Oct 8, 2026
Merged

thostetler merged 2 commits into
adsabs:masterfrom
thostetler:feature/configurable-site-wide-banner

Conversation

@thostetler

@thostetler thostetler commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

site_wide_message can now be a JSON object with msg, dismissable, and
bgColor instead of only a bare string; a bare string still works.

  • The Vault schema needs to accept the object form before this does
    anything — until then the legacy string path is what runs.
  • bgColor sets an inline background, so the banner stops following dark
    mode.

Vault response should still work like normally, but this code now expects a JSON response in the following form:

{
  "msg": "This is a message",
  "dismissable": false,
  "bgColor": "#8GFFF"
}

@thostetler
thostetler force-pushed the feature/configurable-site-wide-banner branch from 1d1b3af to 79f6c12 Compare October 6, 2026 20:42
A bare string still works, since the Vault schema change to support an
object isn't confirmed yet and is what actually runs in production.
dismissable: false skips both already-seen checks, so the banner shows on
every load, but still yields for one load if an error alert already holds
the shared alerts model. bgColor takes a hex value; anything else falls
back to the default palette, which also replaces .alert-info (3.35:1) with
#e8edf7 on #15336f (10.31:1) to pass WCAG AA.
@thostetler
thostetler force-pushed the feature/configurable-site-wide-banner branch from 79f6c12 to a4c4b27 Compare October 6, 2026 20:55
@thostetler
thostetler marked this pull request as ready for review October 6, 2026 20:56
Copilot AI balanced review requested due to automatic review settings October 6, 2026 20:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Existing alert styling regresses, and custom backgrounds can make text, links, and controls difficult to read.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
What changed in this PR

Extends site-wide messages with configurable dismissal and background colors while retaining legacy string input.

Changes:

  • Accepts object-form configuration and updates seen-message handling.
  • Passes new settings through the shared alert widget.
  • Adds conditional closing, color selection, and accessibility attributes.
File Description
src/​js/​wraps/​alerts_mediator.js Parses configuration and handles dismissal persistence.
src/​js/​widgets/​alerts/​widget.js Propagates settings and corrects dependency argument order.
src/​js/​widgets/​alerts/​templates/​page_top_alert.html Conditionally displays closing controls and adds live-region attributes.
src/​js/​widgets/​alerts/​page_top_alert.js Implements palette selection, dismissal guards, and accessibility metadata.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/js/widgets/alerts/page_top_alert.js Resolved
Comment thread src/js/widgets/alerts/page_top_alert.js Resolved
this.$('.alert').css({
'background-color': palette.bg,
color: palette.fg,
});
The YIQ brightness cutoff chose white on backgrounds where it is
unreadable — #00ff00 lands at 1.37:1, #808080 at 3.95:1. Pick the
foreground by WCAG contrast ratio instead, falling back to black.

- resolvePalette returns null with no bgColor, so ordinary alerts and
  dark mode keep their stylesheet colors; the danger banner from
  session.js was rendering pale blue.
- Links and the close control get the resolved foreground, which
  dark-mode.scss and Bootstrap's $close-color otherwise override.
@thostetler
thostetler merged commit 9ab26b3 into adsabs:master Oct 8, 2026
1 check passed
@thostetler
thostetler deleted the feature/configurable-site-wide-banner branch October 8, 2026 17:42
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