Skip to content

Bootstrap 5 modernization: themes, accessibility, forms, and admin polish - #853

Merged
poppastring merged 9 commits into
mainfrom
fixing-themes-bs5
Jun 15, 2026
Merged

poppastring merged 9 commits into
mainfrom
fixing-themes-bs5

Conversation

@poppastring

Copy link
Copy Markdown
Owner

Description

This PR brings the shipped themes and several rough edges of the admin/comment UI in line with Bootstrap 5.3 and current accessibility guidance. It also unblocks longer CSP DefaultSources values in the admin Security page.

  1. Theme modernization
  • New flatly theme — adds Flatly as a sixth built-in (Bootswatch 5.3.8 swatch) with the full partial set, custom overrides, and default SVG. Registered in ThemeManager defaults; ThemeManagerTest updated (theme count 5 → 6, IsBuiltIn case added).
  • Darkly switched to its Bootswatch palette — loads ~/lib/bootswatch/5.3.8/darkly/bootstrap.min.css and uses bg-dark + data-bs-theme="dark" instead of the BS4-era navbar-dark bg-dark pairing. Comments clarify the dasblog-theme / data-bs-theme script that pins the palette.
  • Bootstrap 4 cruft removed — dropped .jumbotron from darkly and dasblog _BlogPageSummary.cshtml (removed in BS5); replaced btn-default with btn-secondary on the median sidebar toggle; dropped the orphaned icon.
  • CSS slimmed dramatically — darkly/custom.css shrunk from ~11k lines to overrides only (the file was a vendored copy of full Bootstrap); median/custom.css trimmed to its override set; orphan median/custom.js removed.
  • Accent color and BS variable tuning — added override blocks (~60 lines each) to flamingo/custom.css and kindofblue/custom.css so their accent palettes map cleanly to BS5 CSS variables.
  • Font Awesome 6.7.2 link added explicitly to darkly, flamingo, kindofblue, and median layouts (previously implicit).
  1. Accessibility — modal dialogs

Removed the static aria-hidden="true" attribute from every modal's outer .modal div. Bootstrap 5 manages this attribute dynamically; leaving it hard-coded on the wrapper causes screen readers to ignore the open modal and trips Chrome's accessibility audit. Applies to:

  • ConfirmationModalTagHelper
  • DeletePostModalTagHelper
  • _HeroImagePickerModal.cshtml (hero picker)
  • ManageComments.cshtml (reply + reply-confirmation modals)
  • The dynamic comment-action modal in wwwroot/js/site.js
  1. Forms — autocomplete attributes

Added the autocomplete attribute on fields where it's expected by password managers and WCAG 1.3.5:

  • Login.cshtml — username, current-password
  • _CommentAddPartial.cshtml — name, email, url on identity fields, off on the spam-challenge answer
  1. Admin — CSP DefaultSources field expansion
  • SiteViewModel.DefaultSources [StringLength] increased from 50 → 600 characters with matching validation message.
  • _Admin_Security.cshtml widened the input column from col-sm-4 to col-sm-12 so longer source lists are usable.

This unblocks anyone whose CSP default-src list grows past the old 50-char ceiling (which the previous limit hit almost immediately on any real install).

Out of scope

  • No engine routing, controller, or tag-helper logic changes beyond the modal aria-hidden strip.
  • Bootstrap version pinning — themes now load either Bootstrap 5.3.3 or Bootswatch 5.3.8. Workable; convergence is a follow-up.
  • 'unsafe-inline' / 'unsafe-eval' CSP hardening is a separate, larger conversation.

```
Modernize built-in themes for Bootstrap 5 and add Flatly

Aligns every shipped theme with Bootstrap 5.3 idioms and removes
Bootstrap 4 leftovers that were causing layout and styling drift.
Also introduces Flatly as a sixth built-in theme.

Themes
- Add Flatly theme (Bootswatch swatch) with full partial set, custom
  overrides, and default SVG. Registered in ThemeManager defaults and
  covered by ThemeManagerTest (theme count 5 -> 6, IsBuiltIn case
  added).
- Switch Darkly to its Bootswatch palette: load
  ~/lib/bootswatch/5.3.8/darkly/bootstrap.min.css and replace
  `navbar-dark bg-dark` with `bg-dark` + `data-bs-theme="dark"` per
  the Bootstrap 5.3 color-mode API. Clarifying comments on the pinned
  `dasblog-theme` / `data-bs-theme` script so the Bootswatch palette
  pairing is obvious.
- Drop the Bootstrap 4 `.jumbotron` class from darkly and dasblog
  `_BlogPageSummary.cshtml` (removed in BS5).
- Add Font Awesome 6.7.2 stylesheet link to darkly, flamingo,
  kindofblue, and median layouts (previously implicit / missing).
- Trim darkly/custom.css from ~11k lines to overrides only (the file
  was a vendored copy of full Bootstrap); trim median/custom.css to
  the override set and remove the now-orphan median/custom.js.

Assets
- Add wwwroot/lib/bootswatch/5.3.8/{darkly,flatly}/bootstrap.min.css.

ThemeManager
- Add "flatly" to the built-in default list so it is recognized
  alongside darkly, dasblog, flamingo, kindofblue, and median.

No engine routing, controller, or tag-helper changes. Theme-only and
ThemeManager defaults.
Expanded DefaultSources max length from 50 to 600 characters in SiteViewModel. Updated the admin security view to make the DefaultSources input field full width for better usability with longer values.
Refreshed Flatly and other themes to use blue or custom accent palettes instead of Bootswatch green. Remapped Bootstrap utility classes (.btn-primary, .bg-primary, etc.) to theme colors for consistent branding. Updated archive navigation, calendar icons, and badges for better readability and cohesion. Simplified site title link and made minor CSS improvements for accessibility and visual consistency. Updated Flatly SVG preview to match new palette.
Removed aria-hidden="true" from all Bootstrap modal elements in ConfirmationModalTagHelper.cs, ManageComments.cshtml, _HeroImagePickerModal.cshtml, and site.js to improve accessibility and align with current ARIA and Bootstrap best practices.
Improved browser autofill and accessibility by specifying autocomplete attributes for login (username, current-password), comment (name, email, url), and anti-spam (off) input fields.
The aria-hidden="true" attribute was removed from the modal's
outer <div> in the generated HTML. This change ensures the
modal is not hidden from assistive technologies by default,
improving accessibility compliance.
Switched sidebar menu button from btn-default to btn-secondary in _Layout.cshtml. Removed .btn-default styles from custom.css, so only .btn-secondary receives the intended button styling and hover effects.
Updated the blog page summary section to improve layout and spacing:
- Added mb-4 to the outer container for more bottom margin
- Changed inner column to col-md-12 for full-width display
- Added mb-3 to the h1 heading for better vertical spacing
Updated summary header with custom colors and full-width layout, adjusted subtitle spacing, and enhanced <post-image> with consistent sizing and object-fit. Minor markup tweaks improve visual consistency across summary sections.
@poppastring
poppastring merged commit d5e57cd into main Jun 15, 2026
3 checks passed
@poppastring
poppastring deleted the fixing-themes-bs5 branch June 15, 2026 01:35
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