Skip to content

webui: adopt Bootstrap 5.3 colour modes, fix dark-mode and a11y issues - #508

Open
tanc wants to merge 1 commit into
jsuto:masterfrom
tanc:theme/dark-mode-bootstrap
Open

tanc wants to merge 1 commit into
jsuto:masterfrom
tanc:theme/dark-mode-bootstrap

Conversation

@tanc

@tanc tanc commented Oct 3, 2026

Copy link
Copy Markdown

What this fixes

piler's web UI loads Bootstrap 5.3.3, but dark mode was built as a separate [data-theme="dark"] attribute with about 260 lines of manual per-component overrides. That left several dark mode bugs and some accessibility problems.

  • The search results table header was unreadable in dark mode. Bootstrap does not darken the .table-secondary variant, so the header showed light text on a light background.
  • The search input placeholder was dark on dark.
  • Alerts and the health "refresh period" strip stayed light on dark pages.
  • The login fields had no accessible name. The labels used for="floatingInput" and for="floatingPassword", which did not match the input ids.
  • The logout link and theme toggle had no accessible name.

Changes

  • assets/js/dark-mode.js now toggles Bootstrap's native data-bs-theme attribute instead of the custom data-theme.
  • assets/css/piler.css is reduced to a small set of design tokens plus brand overrides, so Bootstrap themes its own components (inputs, placeholders, tables, dropdowns) from the --bs-* variables. Net change is about 83 lines removed.
  • Dark mode fixes: theme the .table-secondary header cells, map alerts onto Bootstrap's dark subtle palette, and replace the hardcoded inline health strip with a themed class.
  • Accessibility: associate the login labels with their inputs, label the search and tag inputs, and name the logout and branding links.
  • Markup: remove a duplicate id="menu" wrapper in common/layout.tpl, where the layout and the menu both emitted the same id.

There are no PHP logic, configuration or schema changes. It uses the Bootstrap version already loaded by config.php.in.

Verification

Computed style checks in both themes, against WCAG AA:

  • Search results header: 16.35:1 in light, 10.87:1 in dark.

  • Search placeholder: 6.78:1 in light, 7.99:1 in dark.

  • The login fields now report labels === ["Email address"], so the association is correct.

  • Light and dark toggling was checked on login, search, health, users and message views, at desktop and phone widths.

  • Light mode values are unchanged.

Tested against piler 1.4.9. The webui/ tree is identical between the piler-1.4.9 tag and master.

Dark mode now uses Bootstrap's native data-bs-theme attribute instead of the
parallel data-theme hook. Bootstrap themes its own components (inputs,
placeholders, tables, dropdowns, modals), so most of the hand-written dark
override block is replaced by theme tokens plus a few brand overrides.

- Fix unreadable dark-mode search results header: Bootstrap does not darken
  the .table-secondary contextual variant, leaving light text on a light
  background, so its cells are now themed explicitly.
- Fix dark-mode search input placeholder (was dark-on-dark) and map alerts
  onto Bootstrap's dark subtle palette instead of light strips.
- Theme the health "refresh period" strip (was a hardcoded inline light blue).
- Accessibility: associate the login labels with their inputs (for/id
  mismatch), label the search and tag inputs, and name the logout and
  branding links.
- Markup: remove the duplicate id="menu" wrapper in the common layout.
@tanc
tanc requested a review from jsuto as a code owner October 3, 2026 08:28
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.

1 participant