Skip to content

fix(gallery): Use Link component for Lockdown Mode compatibility (mobile + desktop)#260

Merged
maxrantil merged 5 commits intomasterfrom
fix/issue-259-lockdown-mode-clicks
Dec 29, 2025
Merged

fix(gallery): Use Link component for Lockdown Mode compatibility (mobile + desktop)#260
maxrantil merged 5 commits intomasterfrom
fix/issue-259-lockdown-mode-clicks

Conversation

@maxrantil
Copy link
Owner

@maxrantil maxrantil commented Dec 29, 2025

Problem

Gallery items are not clickable on browsers with Lockdown Mode or strict security settings enabled.

Affects:

  • ❌ Mobile: iOS Safari and Brave with Lockdown Mode
  • ❌ Desktop: Safari and Brave on macOS with strict security settings

Fixes #259

Root Cause

Both mobile and desktop galleries used onClick handlers on non-interactive HTML elements (<article> and <div>). Browsers with strict security settings (iOS Lockdown Mode, Safari/Brave with shields) block JavaScript click events on non-interactive elements as a security measure.

Solution Implemented

Replace non-interactive elements with Next.js <Link> component, which renders as semantic <a> tags that work natively without JavaScript.

Technical Changes

Mobile Gallery (MobileGalleryItem.tsx)

Before (Broken in Lockdown Mode):
```tsx

{/* content */} \`\`\`

After (Lockdown Mode Compatible):
```tsx

{/* content */} \`\`\`

Desktop Gallery (Gallery.tsx)

Before (Broken with strict security):
```tsx

{/* content */}
\`\`\`

After (Security-compatible):
```tsx

{/* content */}
\`\`\`

Benefits

  • Lockdown Mode Compatible: Links are native HTML elements that work without JavaScript
  • Better Semantics: <a> tag for navigation (proper HTML5)
  • Accessibility: Links are keyboard accessible by default
  • Analytics Preserved: onClick handler fires before navigation for tracking
  • Progressive Enhancement: Works even if JavaScript fails to load

Testing

Unit Tests

  • ✅ All 66 Gallery tests passing
  • ✅ Updated tests to verify Link element behavior (href attribute)
  • ✅ Confirmed ARIA attributes, keyboard navigation, touch handling

E2E Tests

  • 🧪 NEEDS MANUAL TESTING on actual devices with Lockdown Mode

Files Changed

  • src/components/mobile/Gallery/MobileGalleryItem.tsx: Use Link instead of article
  • src/components/desktop/Gallery/Gallery.tsx: Use Link instead of div
  • src/components/mobile/Gallery/__tests__/MobileGalleryItem.test.tsx: Updated tests
  • src/components/mobile/Gallery/__tests__/MobileGallery.test.tsx: Updated tests
  • tests/integration/real-gallery-navigation.test.tsx: Updated integration tests

Manual Testing Required

Doctor Hubert, please test on your devices:

Desktop Testing

  1. Open idaromme.dk on your laptop (Safari/Brave with security settings)
  2. Navigate to homepage gallery
  3. Click on any gallery item
  4. Expected: Should navigate to project page immediately

Mobile Testing

  1. Open idaromme.dk on iPhone (Lockdown Mode enabled)
  2. Scroll to gallery
  3. Tap on any gallery item
  4. Expected: Should navigate to project page immediately

Browsers to Test

  • Desktop Safari (macOS)
  • Desktop Brave (macOS with shields)
  • iPhone Safari (Lockdown Mode)
  • iPhone Brave (Lockdown Mode)

Deployment

Once tested and confirmed working on all devices, this can be merged and deployed.

Issue #259: Mobile gallery not clickable in iOS Lockdown Mode

Root cause: onClick on <article> element blocked by iOS Lockdown Mode
security restrictions.

Solution: Replace article with Next.js Link component, which renders
as semantic <a> tag that works natively without JavaScript.

Changes:
- MobileGalleryItem now uses Link with href for navigation
- onClick handler kept for analytics/sessionStorage (fires before nav)
- Updated tests to check Link element instead of article
- All 23 unit tests passing

Benefits:
- Works in iOS Lockdown Mode (Links are native HTML elements)
- Better semantic HTML (<a> tag for navigation)
- Maintains accessibility (Links are keyboard accessible by default)
- Preserves analytics and session storage functionality
@github-actions
Copy link

🔍 Lighthouse Performance Report

❌ No Lighthouse results found. Check the workflow logs for details.


This report was generated by Lighthouse CI in GitHub Actions

@github-actions
Copy link

github-actions bot commented Dec 29, 2025

🎯 Performance Budget Summary

Bundle Size Analysis

  • Status: warning
  • Total Size:
  • Budget: 1.5MB (1.45MB in CI)

Lighthouse Performance Validation

Desktop Results

  • Performance Score: Target 98%+
  • LCP: Target <1s
  • CLS: Target <0.05

Mobile Results

  • Performance Score: Target 98%+
  • LCP: Target <1s
  • CLS: Target <0.05

Performance Budget Status

  • Bundle Size: FAILED
  • Lighthouse Budget: PASSED

Next Steps

  • 🔧 Optimize bundle size to meet budget constraints

Generated at $(date)

@github-actions
Copy link

🔍 Lighthouse Performance Report

❌ No Lighthouse results found. Check the workflow logs for details.


This report was generated by Lighthouse CI in GitHub Actions

@maxrantil maxrantil changed the title fix(mobile): Use Link component for iOS Lockdown Mode compatibility - Issue #259 fix(gallery): Use Link component for Lockdown Mode compatibility (mobile + desktop) Dec 29, 2025
Applies the same Lockdown Mode fix to desktop gallery as was done for
mobile in previous commit. Desktop browsers with strict security settings
(Safari, Brave) also block onClick handlers on non-interactive elements.

Changes:
- Replace div onClick with Next.js Link component in desktop Gallery
- Link renders as semantic <a> tag that works without JavaScript
- Remove router.push call (navigation handled by Link href)
- Remove keyboard handlers (Link provides native keyboard support)
- Update tests to check Link href instead of router.push calls

This fixes desktop gallery not clickable on Doctor Hubert's laptop.

Related: Issue #259 (Lockdown Mode compatibility)
@github-actions
Copy link

🔍 Lighthouse Performance Report

❌ No Lighthouse results found. Check the workflow logs for details.


This report was generated by Lighthouse CI in GitHub Actions

Gallery items are now Link elements (for Lockdown Mode compatibility)
instead of divs with role=button. Updated test to check for links
instead of buttons, and adjusted navigation button expectations.
@github-actions
Copy link

🔍 Lighthouse Performance Report

❌ No Lighthouse results found. Check the workflow logs for details.


This report was generated by Lighthouse CI in GitHub Actions

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 82.97872% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rc/components/mobile/Gallery/MobileGalleryItem.tsx 80.95% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

Remove fireEvent and waitFor imports that are no longer needed
after converting from onClick testing to Link href checking.
@github-actions
Copy link

🔍 Lighthouse Performance Report

❌ No Lighthouse results found. Check the workflow logs for details.


This report was generated by Lighthouse CI in GitHub Actions

@maxrantil maxrantil marked this pull request as ready for review December 29, 2025 09:43
@maxrantil maxrantil merged commit e59d5cb into master Dec 29, 2025
19 of 21 checks passed
@maxrantil maxrantil deleted the fix/issue-259-lockdown-mode-clicks branch December 29, 2025 09:43
maxrantil added a commit that referenced this pull request Dec 29, 2025
Issue #259 resolved and PR #260 merged successfully.
Gallery Lockdown Mode compatibility fix complete for both
mobile and desktop galleries.
maxrantil added a commit that referenced this pull request Dec 29, 2025
Issue #259 resolved and PR #260 merged successfully.
Gallery Lockdown Mode compatibility fix complete for both
mobile and desktop galleries.
maxrantil added a commit that referenced this pull request Dec 29, 2025
Adds comprehensive regression tests to prevent reverting Link components
back to onClick handlers on non-interactive elements.

Unit Tests (11 tests):
- Verify gallery items are Link elements (semantic <a> tags)
- Verify href attributes exist for native navigation
- Verify no role="button" on articles/divs
- Verify JavaScript-free navigation works
- Verify cross-platform consistency

E2E Tests (7 scenarios):
- Simulate Lockdown Mode (JavaScript disabled)
- Verify strict browser security compatibility
- Test keyboard accessibility
- Validate SEO/crawlability with proper links

These tests will catch if anyone accidentally reverts to the broken
pattern that caused iOS Lockdown Mode and desktop browser security
issues (Issue #259).

Related: #259, #260
maxrantil added a commit that referenced this pull request Jan 2, 2026
* test: Add regression tests for Issue #259 Lockdown Mode fix

Adds comprehensive regression tests to prevent reverting Link components
back to onClick handlers on non-interactive elements.

Unit Tests (11 tests):
- Verify gallery items are Link elements (semantic <a> tags)
- Verify href attributes exist for native navigation
- Verify no role="button" on articles/divs
- Verify JavaScript-free navigation works
- Verify cross-platform consistency

E2E Tests (7 scenarios):
- Simulate Lockdown Mode (JavaScript disabled)
- Verify strict browser security compatibility
- Test keyboard accessibility
- Validate SEO/crawlability with proper links

These tests will catch if anyone accidentally reverts to the broken
pattern that caused iOS Lockdown Mode and desktop browser security
issues (Issue #259).

Related: #259, #260

* fix(analytics): disable analytics to fix gallery clicks

Analytics server (analytics.idaromme.dk) is down (504 timeout), returning
HTML instead of JavaScript. This causes MIME type mismatch errors that
break React hydration, preventing gallery clicks from working.

HOTFIX: Temporarily disable analytics script loading until server is fixed.

Fixes #263
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.

Critical: Mobile gallery not clickable in iOS Lockdown Mode

2 participants