Skip to content

fix:dark mode across virtual labs#835

Merged
A1L13N merged 7 commits intoalphaonelabs:mainfrom
Ananya44444:fix/virtual-lab-dark-mode
Feb 12, 2026
Merged

fix:dark mode across virtual labs#835
A1L13N merged 7 commits intoalphaonelabs:mainfrom
Ananya44444:fix/virtual-lab-dark-mode

Conversation

@Ananya44444
Copy link
Contributor

@Ananya44444 Ananya44444 commented Feb 7, 2026

Related issues

Fixes #834

Checklist

  • Did you run the pre-commit? (If not, your PR will most likely not pass — please ensure it passes pre-commit)
  • Did you test the change? (Ensure you didn’t just prompt the AI and blindly commit — test the code and confirm it works)
  • Added screenshots to the PR description (if applicable)

Description

Fix dark mode not applying to Virtual Lab landing page (home.html) content and layout wrapper while working correctly on navbar and footer.

Note: Individual physics/chemistry lab pages will be updated in a separate PR.

Problem

The Virtual Lab page (/en/virtual_lab) dark mode toggle only affected the navbar and footer, leaving the main page content in light mode regardless of the dark mode setting.

The Virtual Lab templates (layout.html and home.html) were missing dark: Tailwind CSS variants on all color-related classes. While dark mode was functioning correctly (the dark class was being added to the <html> element by the main site JavaScript), these templates had hardcoded light-mode colors without dark mode alternatives.

Solution

Added dark: Tailwind CSS variants to all color classes throughout the Virtual Lab templates:

Files Changed

  • web/virtual_lab/templates/virtual_lab/layout.html
  • web/virtual_lab/templates/virtual_lab/home.html

Screenshots

image
Screen.Recording.2026-02-07.234457.mp4

Summary by CodeRabbit

  • Style

    • Added comprehensive dark mode across the site: navigation, header, footer, content cards, typography, borders, gradients, hover/focus states, and dropdowns now include dark variants for improved low-light UX.
  • Refactor

    • Standardized template/block structure and naming for more consistent, maintainable layout rendering.

Copilot AI review requested due to automatic review settings February 7, 2026 18:17
@github-actions github-actions bot added the files-changed: 2 PR changes 2 files label Feb 7, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes dark mode styling on the Virtual Lab landing page by adding missing Tailwind dark: variants so the main page content reflects the global dark mode toggle (consistent with the rest of the site).

Changes:

  • Added dark: Tailwind variants to Virtual Lab layout wrapper/header/footer elements.
  • Added dark: Tailwind variants to Virtual Lab home page card layout and typography.
  • Minor template cleanup (explicit {% endblock <name> %} and copyright symbol).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
web/virtual_lab/templates/virtual_lab/layout.html Adds dark-mode background/text/border variants to the Virtual Lab shell layout.
web/virtual_lab/templates/virtual_lab/home.html Adds dark-mode variants to the Virtual Lab home page content/cards.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Applies Tailwind dark-mode classes across the Virtual Lab layout and home templates and renames anonymous endblock tags to explicit names (virtual_lab_content, extra_scripts). No backend or routing logic changed; edits are limited to theming, gradients, nav submenu visibility, and template block naming.

Changes

Cohort / File(s) Summary
Virtual Lab templates
web/virtual_lab/templates/virtual_lab/home.html, web/virtual_lab/templates/virtual_lab/layout.html
Added Tailwind dark-mode variants (dark:bg-*, dark:text-*, dark:border-*, dark:from-*/dark:to-*) across main container, header, navigation, dropdown submenu, feature cards, gradients, and footer. Switched extends quoting in layout and replaced anonymous endblocks with named virtual_lab_content and extra_scripts. Verify dropdown focus/visibility and dark hover/focus styles.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix:dark mode across virtual labs' clearly summarizes the main change—adding dark mode styling to Virtual Lab templates.
Linked Issues check ✅ Passed The PR successfully implements dark mode across Virtual Lab templates by adding Tailwind CSS dark: variants to color classes, fully addressing issue #834's requirement that dark mode apply to entire Virtual Lab page.
Out of Scope Changes check ✅ Passed Changes are limited to adding dark mode styling and updating block naming in Virtual Lab templates; all changes directly support the linked issue objective with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/virtual_lab/templates/virtual_lab/home.html (1)

1-49: ⚠️ Potential issue | 🟡 Minor

Fix djlint formatting to pass CI.

The pipeline reports djlint-django: Linting failed; file reformatted. Run pre-commit run djlint-django --all-files (or just pre-commit run --all-files) locally and commit the reformatted output. This is blocking the pipeline.

🤖 Fix all issues with AI agents
In `@web/virtual_lab/templates/virtual_lab/layout.html`:
- Around line 1-51: The template
web/virtual_lab/templates/virtual_lab/layout.html is failing djlint formatting
(CI) — run the formatter locally (e.g., pre-commit run --all-files or djlint) to
reformat the Django template around the top-level "{% block content %}" and
nested "{% block virtual_lab_content %}" / "{% block extra_scripts %}" sections
(the header/nav/footer HTML structure) and commit the reformatted file so the
linter passes.
- Line 44: The footer uses the non-existent template variable "{{ now.year }}",
so update the layout.html template to use Django's built-in now template tag
instead of the missing now variable: locate the line containing "{{ now.year }}"
in virtual_lab layout.html and replace it with a {% now "Y" %} expression so the
current year renders correctly without adding view context or processors.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@web/virtual_lab/templates/virtual_lab/layout.html`:
- Around line 19-30: The dropdown only opens on hover and removes the focus
ring; update the button/dropdown group so keyboard users can open the menu by
focus: add Tailwind variants that mirror the hover behavior using
group-focus-within (e.g., replace/augment group-hover:opacity-100 and
group-hover:pointer-events-auto with group-hover:... plus group-focus-within:...
on the dropdown panel) and remove the blanket focus:outline-none on the button
(or replace it with a visible custom focus style like focus:ring /
focus:ring-offset classes) so the button has a clear focus indicator; target the
existing elements using the "group" wrapper, the button element with class
"focus:outline-none", and the dropdown panel with
"group-hover:opacity-100"/"group-hover:pointer-events-auto" to make these
changes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@web/virtual_lab/templates/virtual_lab/layout.html`:
- Line 44: The HTML has inconsistent indentation between the comment node "<!--
Footer -->" and the following "<footer>" element; locate the comment and the
footer tag in virtual_lab/layout.html and align their leading whitespace to the
same indentation level (e.g., change the comment to match the footer's 4-space
indent or vice versa) so both are consistently indented and djlint won't
complain.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@web/virtual_lab/templates/virtual_lab/layout.html`:
- Around line 19-30: The dropdown anchor items inside the Physics menu lack the
Tailwind "transition" class causing abrupt hover changes; update each anchor
element (the <a> tags linking to virtual_lab:physics_pendulum,
virtual_lab:physics_projectile, virtual_lab:physics_inclined) to include
"transition" alongside their existing classes so their background-color hover
states animate consistently with the top-level nav buttons and satisfy the
hover/focus interactive element guideline.
- Around line 24-29: The three dropdown link labels for the physics pages are
hardcoded and not internationalized; update the anchor text for the links
pointing to the URL names virtual_lab:physics_pendulum,
virtual_lab:physics_projectile, and virtual_lab:physics_inclined to wrap the
visible strings in the Django translation tag (i.e., replace the literal
"Pendulum", "Projectile", and "Inclined Plane" with {% trans "Pendulum" %}, {%
trans "Projectile" %}, and {% trans "Inclined Plane" %} respectively) so they
match the other nav items and become translatable.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@web/virtual_lab/templates/virtual_lab/layout.html`:
- Around line 19-31: The dropdown currently relies only on CSS hover/focus and
lacks ARIA/menu semantics; update the button element (the "Physics" button) to
include aria-haspopup="true" and a dynamic aria-expanded attribute that toggles
when the menu is opened/closed, give the dropdown container role="menu" and each
anchor role="menuitem", and implement minimal keyboard handling on the button
and menu (toggle open/close on Enter/Space, close on Escape, and manage focus
into the first/last menuitem with ArrowUp/ArrowDown) so screen readers and
keyboard users receive proper menu semantics and can operate the menu without a
mouse.

@A1L13N A1L13N added this pull request to the merge queue Feb 12, 2026
Merged via the queue into alphaonelabs:main with commit ea02d5a Feb 12, 2026
13 checks passed
@Ananya44444 Ananya44444 deleted the fix/virtual-lab-dark-mode branch February 12, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 2 PR changes 2 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dark mode does not apply to main content on Virtual Lab page

3 participants