Skip to content

add modal color and open-on-load visibility - #1526

Open
mvanhorn wants to merge 6 commits into
sqlpage:mainfrom
mvanhorn:fix/1258-modal-visible-color
Open

mvanhorn wants to merge 6 commits into
sqlpage:mainfrom
mvanhorn:fix/1258-modal-visible-color

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 6, 2026 •

Copy link
Copy Markdown

The modal template and its parameter list now accept color and visible. A modal could not be given a header color, and it stayed closed when the page loaded.

Tests for this live in tests/end-to-end/fixtures/modal-visible/index.sql and tests/end-to-end/fixtures/modal-visible/test.ts.

Fixes #1258

mvanhorn and others added 4 commits October 6, 2026 04:46
The modal template and its parameter list now accept color and visible.
color applies a Tabler background and the same contrasting foreground
used by a colored toast to the header only, mapping white to the light
foreground and adding text-reset on the title; an empty or omitted color
adds no classes, and the body and footer are left alone. visible sets
data-modal-visible and does not emit a script. Client init then shows
the last marked modal through Bootstrap unless the URL hash already
names a different modal, removes every marker so a later fragment load
does not open an earlier dialog or reopen one the user closed, and
leaves the address unchanged.

Fixes sqlpage#1258
Keep the header color classes with close_label from main, update the
visible modal code for the removed ModalWidget type, and move the visible
and color scenarios to a modal-visible fixture so the modal fixture from
main keeps its own page.

Main now announces each moved modal synchronously, which reran the visible
check and opened a dialog that was then moved mid-transition and stayed
hidden. Move every modal before announcing any of them.
Resolve the CHANGELOG conflict by keeping the modal entry under
"unreleased" above the new v0.48.0 section.
@mvanhorn

Copy link
Copy Markdown
Author

Merged main into this branch in 1f8138f to resolve the CHANGELOG conflict after the v0.48.0 cut, keeping the modal entry under unreleased. The color and visible changes in modal.handlebars sit alongside the new close_label and height properties from main.

@mvanhorn

Copy link
Copy Markdown
Author

Merged main again in 92f7fe3 to clear the new CHANGELOG conflict from the v0.48.0 date change: the modal entry stays under unreleased and the release heading now reads 2026-11-12. No code changed.

@mvanhorn

Copy link
Copy Markdown
Author

Merged main in 0f742d4 to clear the CHANGELOG conflict with the big_number wrap entry. Both entries now sit under unreleased. No code changed.

@lovasoa lovasoa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hello ! Sorry for the delay, I finally got around to testing this.

No comment on the visible addition, I'm ready to merge it as-is now if you split it out.

For the color, I'm not sure about a color option that only changes the color of the header, and has a hardcoded special case for "white". Why not coloring the entire modal ?

@mvanhorn

Copy link
Copy Markdown
Author

Thanks for testing it.

I kept the color on the header because the body can hold any component (forms, tables, cards), and those don't adapt to a colored background, so a green or red body would hurt readability. The "white" special case was there to give a white header a readable foreground. It is a hack, I agree.

visible and color are independent in this diff: visible is the data-modal-visible attribute plus the open-on-load block in sqlpage.ts, and color is only the header classes in modal.handlebars. For color, would you rather have it on the whole .modal-content, with the body text following the contrasting foreground, or dropped?

@lovasoa

lovasoa commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

I think you need to experiment to find a way to set color that visually looks good, is useful, and is coherent with the rest of SQLPage components. For visible if you split it out in a different PR I'll merge it now.

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.

'modal' component working like 'popup' component

2 participants