Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5ccab38
feat: Add caching and error logging specifications for navigation men…
brylie Nov 3, 2025
add1c1c
feat: Clarify mobile and desktop navigation behavior in specification…
brylie Nov 3, 2025
257a306
feat: Implement site-wide navigation menu system with multi-lingual s…
brylie Nov 3, 2025
359e471
test: Add comprehensive navigation tests and fix locale handling
brylie Nov 3, 2025
63ff99d
test: Add template rendering tests to improve coverage
brylie Nov 3, 2025
0da938a
docs: Update spec to reflect single-template implementation
brylie Nov 3, 2025
369cae2
docs: Add comments explaining intentional desktop/mobile rendering se…
brylie Nov 3, 2025
bbfce37
docs: Explain why blocks don't use Meta.template for self-rendering
brylie Nov 3, 2025
b8698b6
Add validation to prevent empty dropdown menus
brylie Nov 3, 2025
65d5a7e
Fix ARIA relationship for dropdown trigger buttons
brylie Nov 3, 2025
3edfee7
Optimize database queries with page ID prefetching
brylie Nov 3, 2025
1bb885b
Ensure HomePage fixture exists in test setUp methods
brylie Nov 3, 2025
56ab7f6
Fix validation to not swallow parent errors
brylie Nov 3, 2025
4b81499
Update aria-expanded for both drawer labels
brylie Nov 3, 2025
e2f9ce3
Add translation prefetching to eliminate N+1 queries
brylie Nov 3, 2025
1c7e3b5
Simplify exception handling in translation lookup
brylie Nov 3, 2025
4c9d041
Increase dropdown menu z-index for proper layering
brylie Nov 3, 2025
4099263
Fix edge-detection to measure menu width correctly
brylie Nov 3, 2025
d1b7a29
Add critical live status check for localized pages
brylie Nov 5, 2025
5f106ba
Optimize translation prefetch to only fetch needed locales
brylie Nov 5, 2025
8e0ed52
fix: Add migration to alter menu_items field in navigationmenusetting
brylie Nov 5, 2025
0d21f20
fix: Update navbar background color for consistency across desktop an…
brylie Nov 5, 2025
60b556f
feat: Add management command to scaffold test navigation content
brylie Nov 5, 2025
c5ac07d
docs: Update CONTRIBUTING.md and README.md with Tailwind CSS setup an…
brylie Nov 5, 2025
17f8700
fix: Correct StreamField data structure in scaffold_navbar_content
brylie Nov 5, 2025
00a23fb
refactor: Simplify navigation template structure and remove unused mo…
brylie Nov 5, 2025
76e60ba
fix: Add container and padding classes to main content for improved l…
brylie Nov 5, 2025
30e185f
fix: Enhance mobile menu accessibility with ARIA attributes and keybo…
brylie Nov 5, 2025
b9c8540
fix: Improve formatting and clarity in CONTRIBUTING.md for installati…
brylie Nov 5, 2025
c946473
fix: Update Python settings in VSCode for improved environment manage…
brylie Nov 5, 2025
9a41edb
fix: Update development workflow instructions to emphasize using 'uv'…
brylie Nov 5, 2025
86d0b80
test: Add management command tests for scaffold_navbar_content functi…
brylie Nov 5, 2025
2c68594
fix: Update scaffold_navbar_content command to use 'dev_' prefix for …
brylie Nov 5, 2025
0216048
fix: Refactor StreamFieldTests to remove redundant imports and improv…
brylie Nov 5, 2025
324c807
fix: Refactor TemplateTagTests to use a helper method for mock block …
brylie Nov 5, 2025
ae46370
feat: Add translation tests for navigation menu and multi-lingual sup…
brylie Nov 5, 2025
b0a7e6d
test: Add idempotency test for scaffold_navbar_content command
brylie Nov 5, 2025
da831bf
fix: Reset migrations
brylie Nov 5, 2025
f6b4d9a
fix: Update scaffold_navbar_content command to report page creation a…
brylie Nov 5, 2025
657b658
feat: Add --force-menu option to scaffold_navbar_content command to o…
brylie Nov 5, 2025
f26964e
fix: Ensure HomePage exists for template tag and management command t…
brylie Nov 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,16 @@
".specify/scripts/bash/": true,
".specify/scripts/powershell/": true
},
"terminal.integrated.cwd": "${workspaceFolder}/src"
"terminal.integrated.cwd": "${workspaceFolder}/src",
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.terminal.activateEnvironment": true,
"python.testing.unittestEnabled": true,
"python.testing.unittestArgs": [
"-v",
"-s",
".",
"-p",
"test*.py"
],
"python.testing.cwd": "${workspaceFolder}/src"
}
46 changes: 37 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ class HeadingBlock(blocks.StructBlock):

**Security**: Use `EmbedBlock` (oEmbed) for embedded content, NEVER `RawHTMLBlock` (XSS risk).

**Navigation Menu Pattern**: See `src/navigation/blocks.py` for nested block structure that enforces 2-level maximum:
- `TopLevelMenuBlock` (StreamBlock) contains page_link, external_link, OR dropdown
- `DropdownMenuBlock` (StructBlock) contains title and items (MenuItemBlock)
- `MenuItemBlock` (StreamBlock) contains ONLY page_link and external_link (no nested dropdowns)

This structural approach prevents 3+ level nesting at the schema level.

### 4. Translation & Locale Management

- Translation UI comes from `wagtail.contrib.simple_translation` (already installed)
Expand All @@ -62,22 +69,42 @@ class HeadingBlock(blocks.StructBlock):

## Development Workflow

### Essential Commands (from `src/` directory)
### Essential Commands

**IMPORTANT**: This project uses `uv` for package management. When running Python commands in terminals (especially from AI assistants or automated tools), the virtual environment may not be automatically activated. **Always prefix Python commands with `uv run`** to ensure the correct environment is used:

```bash
# ✅ CORRECT - Use uv run for all Python commands
uv run python manage.py test
uv run python manage.py migrate
uv run python manage.py runserver

# ❌ WRONG - May fail if virtual environment isn't activated
python manage.py test
```

#### Package Management (from project root)

```bash
# Package management (from project root)
uv sync # Install all deps (creates .venv/)
uv add package-name # Add runtime dependency
uv add --dev package-name # Add dev dependency
```

#### Django Commands (from src/ directory)

# Django (from src/ directory)
```bash
cd src
python manage.py migrate
python manage.py test # Run all tests (64 total)
python manage.py test locales.tests # Run specific app tests
python manage.py createsuperuser # One-time setup
uv run python manage.py migrate
uv run python manage.py test # Run all tests
uv run python manage.py test navigation # Run specific app tests
uv run python manage.py createsuperuser # One-time setup
uv run python manage.py runserver # Development server
```

# Code quality (from project root)
#### Code Quality (from project root)

```bash
uv run pre-commit install # One-time setup
uv run pre-commit run --all-files # Manual run
uv run ruff check --fix . # Lint with auto-fix
Expand Down Expand Up @@ -183,8 +210,9 @@ from core.constants import DEFAULT_LANGUAGE_CODE, DEFAULT_LANGUAGES
- **curlylint** - Template linting

### Migration Best Practices

1. Test migrations are auto-generated
2. based on model changes
2. based on model changes
3. Run `python manage.py makemigrations` after model changes
4. All StreamField changes require migrations (block structure changes)
5. Check migration files into version control
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **Navigation Menu System**: Site-wide multi-lingual navigation with WCAG 2.1 AA accessibility
- Site-wide navigation menu configuration via Wagtail Settings (BaseSiteSetting pattern)
- StreamField-based menu structure with PageLinkBlock, ExternalLinkBlock, and DropdownMenuBlock
- **2-level menu maximum**: Enforced at schema level - prevents nested dropdowns
- **Locale-aware rendering**: Automatic page translation linking with fallback to default locale
- **Full WCAG 2.1 AA compliance**: ARIA menubar pattern, keyboard navigation, screen reader support
- **DaisyUI responsive design**: Mobile hamburger drawer, desktop horizontal menu
- **Accessibility features**:
- Skip link to main content (first focusable element)
- ARIA attributes (role, aria-label, aria-current, aria-expanded, aria-haspopup, aria-controls)
- 44x44px minimum touch targets for mobile
- Visible focus indicators (3:1 contrast ratio)
- Progressive enhancement with `<details>`/`<summary>` for dropdowns
- **Dropdown edge detection**: JavaScript prevents viewport overflow (opens left/right/down based on space)
- **Keyboard support**: Tab, Enter, Space, Escape, Arrow keys for full navigation
- **Theme-aware**: Automatic adaptation to light/dark mode via DaisyUI
- **7 comprehensive tests**: ModelTests, StreamFieldTests, IntegrationTests for dropdown structure
- Developer documentation in `specs/002-nav-menu-system/` (plan, data model, contracts, quickstart)
- Template tag: `{% load navigation_tags %}{% navigation_menu %}`
- **Tailwind CSS Integration**: Modern utility-first CSS framework with DaisyUI components
- Tailwind CSS v4 with @source directive for automatic template scanning
- DaisyUI plugin with semantic component classes (buttons, cards, navigation, forms, alerts)
Expand Down
Loading