Audit and refactor CSS for consistency, clarity, and anti-pattern removal#517
Open
cycomachead wants to merge 1 commit into
Open
Audit and refactor CSS for consistency, clarity, and anti-pattern removal#517cycomachead wants to merge 1 commit into
cycomachead wants to merge 1 commit into
Conversation
- Remove all 68 `!important` declarations by leveraging Bootstrap 5.3 CSS variables and proper selector specificity. - Delete ~330 lines of dead CSS, including unused Bootstrap doc examples and redundant custom classes. - Fix dark mode contrast issues and bugs, achieving 40/40 passing axe accessibility scores. - Move sidebar state logic from inline styles/JS-direct-manipulation to CSS classes. - Correct broken media queries for the theme toggler and fix garbled DataTables selectors. - Update Sprockets manifest to prevent duplicate CSS compilation. Co-authored-by: Claude Code <noreply@anthropic.com>
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.
CSS Audit and Refactor: Consistency, Accessibility, and Anti-Pattern Removal
Changes
This PR completes a full audit and overhaul of the application's CSS to remove anti-patterns, eliminate dead code, fix dark mode bugs, and achieve consistent accessibility across both themes.
!importantremoval (68 declarations → 0): The stylesheet had an!importantarms race where custom classes like.accessible-textand.dark-form-sectionforced colors, which forced dark-mode fixes to use!importantto win back control. These classes duplicated what Bootstrap 5.3's native dark mode already provides. They've been deleted from both the CSS and the views. Dark-mode colors now flow through Bootstrap's CSS custom properties (--bs-link-color,--bs-pagination-active-bg,--bs-nav-link-color,--bs-btn-*, etc.), andcodecolors are set via Sass variables ($code-color,$code-color-dark) so Bootstrap generates the correct rules itself.~330 lines of dead CSS removed: Deleted unused Bootstrap docs examples (
.bd-placeholder-img,.b-example-divider,.nav-scroller,.btn-bd-primary,.bd-mode-toggle), app classes with no remaining users (.action-btn,.sidebar-container,.accessible-text,.dark-form-section,.accessible-link,.sr-only,.bg-light-subtleblock), and an unimported vendor file (datatables/buttons.bootstrap5.css).Sidebar state moved to CSS classes: The sidebar had
style="position: fixed; ..."inline in the ERB, andsidebar_controller.jstoggledstyle.displaydirectly — which is why the desktop media query needed!importantto override it. All visual state is now driven by theexpandedclass on#sidebarandsidebar-openonbody. The JS controller only toggles classes, and adisconnect()hook properly cleans up event listeners.Bugs fixed:
min-width: 992px/max-width: 992pxqueries both hid their toggler at exactly 992px. Replaced custom.color-mode-togglerclasses with Bootstrap'sd-lg-none/d-none d-lg-block.#login-button-index { color: #000 !important }on abtn-primary(Berkeley blue) button gave ~1.6:1 contrast. Removed.background: #f8f9faon.expandedreplaced by the theme-awarebg-body-tertiaryclass..flextensions-table thead th, th.dt-type-numeric, ...selector compiled into rules that matched nothing; rewritten with correct nesting so headings stay centered after DataTables adds per-type alignment classes.manifest.jsusedlink_directory, which compiled_*.scsspartials standalone (where Sass variables aren't defined). Now links onlyapplication.css.style="text-align: center"etc. in_footer.html.erbwith Bootstrap utility classes..sr-only→.visually-hidden: Updated all 11 views to use Bootstrap's built-in utility.Testing
rspec --tag a11y: 40/40 pass — axe contrast checks on every major page, both light and dark themes, teacher and student roles.Visual Changes
Documentation
No documentation changes required. The CSS is now self-documenting via inline comments explaining each override and why
!importantis not needed.Checklist
Superconductor Ticket Implementation | App Preview | Guided Review