ilhamdev commited on
Commit
beff9f5
·
1 Parent(s): 9b84015

fix(navbar): resolve mobile header collision, reflow secondary actions to drawer, and pass anti-slop audit

Browse files
anti-slop/audit-001-2026-10-11.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Anti-Slop UI Audit #001
2
+
3
+ - **Date:** 2026-10-11
4
+ - **Target Component:** Mobile Navbar Header (`frontend/index.html`, `frontend/src/styles/base.css`, `frontend/src/styles/components.css`)
5
+ - **Mode:** Mode 2 (After)
6
+ - **Viewport Tested:** 390x844 (Mobile), 502px (Compact Window), and 768px (Tablet) via Chrome DevTools
7
+
8
+ ---
9
+
10
+ ## Numbered Findings List
11
+
12
+ ### 1. [HIGH] R-03 (Mobile Responsiveness) — Flex-shrink collision crushes `.brand` to 0px width
13
+ - **Violated Rule:** R-03 — Mobile Responsiveness (Hard Gate: HIGH)
14
+ - **Reason:** `.brand` has `flex-shrink: 1; min-width: 0;` while `.nav-actions` has `flex-shrink: 0;`, crushing the logo and title to 0px width and causing text like "Studio" to render underneath status badge and theme toggle buttons.
15
+ - **Evidence:** DevTools measurement at 390px-502px shows `.brand` width = `0px`, with text colliding directly beneath `.status-badge` and `#themeToggleBtn`.
16
+ - **Proposed Fix:** Set `flex-shrink: 0` and `min-width: max-content` on `.brand`; hide decorative sub-elements (`.brand-tag`) on small viewports while preserving `.brand-title` readability.
17
+
18
+ ### 2. [HIGH] R-03 (Mobile Responsiveness) — `.nav-actions` width exceeds mobile viewport, causing horizontal overflow
19
+ - **Violated Rule:** R-03 — Mobile Responsiveness (Hard Gate: HIGH)
20
+ - **Reason:** Forcing 5 desktop action buttons (`#apiStatusBadge`, `#themeToggleBtn`, `.whatsapp-btn`, `.nav-link-btn`, `#mobileMenuBtn`) side-by-side in a single row requires 556px, causing severe horizontal overflow and pushing the hamburger button off-screen on mobile screens (360px-480px).
21
+ - **Evidence:** DevTools measurement at 390px shows `.nav-actions` scrollWidth = `556px` vs container clientWidth = `358px` (overflow ~198px). The hamburger button is pushed past the right viewport boundary.
22
+ - **Proposed Fix:** Reflow secondary actions (`.whatsapp-btn`, `.nav-link-btn`, and expanded status text) into the mobile navigation drawer (`.nav-links`) when collapsed, keeping only essential controls (`.brand`, compact status dot, `#themeToggleBtn`, `#mobileMenuBtn`) in the top bar on mobile (< 640px).
23
+
24
+ ### 3. [HIGH] R-03 (Mobile Responsiveness / antislop-layoutmobile: "Nav That Stays Desktop") — Desktop action links kept in top bar instead of reflowing into mobile pattern
25
+ - **Violated Rule:** R-03 — Mobile Responsiveness (Hard Gate: HIGH)
26
+ - **Reason:** Full CTA text button (`<span>WhatsApp</span>`) and external link (`<span>GitHub</span>`) remain forced in the top navbar row on narrow screens instead of adapting to a mobile navigation pattern.
27
+ - **Evidence:** `.whatsapp-btn` alone consumes ~120px on a 390px screen with full text label.
28
+ - **Proposed Fix:** Move full-width styled WhatsApp CTA and GitHub link into the mobile dropdown drawer (`.nav-links`) below the page anchor links, so they are spacious, thumb-friendly, and accessible when the menu is open.
29
+
30
+ ### 4. [HIGH] R-03 (Mobile Responsiveness / antislop-layoutmobile: "Targets Too Close") — Crowded touch targets risk mis-taps on mobile
31
+ - **Violated Rule:** R-03 — Mobile Responsiveness (Hard Gate: HIGH)
32
+ - **Reason:** Due to 5 controls jammed into a single row with 0.5rem gap, buttons collide and touch each other, making reliable 44x44px touch operation impossible.
33
+ - **Evidence:** Overlapping visual bounds between `#apiStatusBadge`, `#themeToggleBtn`, and `.whatsapp-btn` on 390px viewport.
34
+ - **Proposed Fix:** Maintain comfortable 42px-44px touch targets with a clean 0.65rem gap between the remaining 3 controls in the mobile header, with zero overlap.
35
+
36
+ ### 5. [MEDIUM] R-05 (Layout & Page Structure / Mobile Navigation) — Breakpoint step gap causes severe crushing between 481px and 768px
37
+ - **Violated Rule:** R-05 — Layout & Page Structure (Purpose-Gate: MEDIUM)
38
+ - **Reason:** Hiding of `.status-text` and `.nav-link-btn span` only triggers at `max-width: 480px`, leaving tablet and small landscape screens (481px-768px) with severe overcrowding where `.nav-actions` still consumes 556px.
39
+ - **Evidence:** At 502px width in DevTools, `.nav-actions` width is 556px and `.brand` is 0px.
40
+ - **Proposed Fix:** Elevate the breakpoint reflow to `max-width: 640px` and `max-width: 768px` so tablets and medium phones smoothly transition without content collision.
41
+
42
+ ---
43
+
44
+ ## Action Plan Upon Approval
45
+
46
+ 1. **Item 1 & Item 2:** Adjust `.navbar`, `.brand`, and `.nav-actions` in `frontend/src/styles/base.css` so `.brand` never shrinks to 0 and top row only hosts the essential controls on mobile.
47
+ 2. **Item 3:** Add mobile drawer CTA blocks in `frontend/index.html` (or display copies in `.nav-links`) and hide top-bar WhatsApp/GitHub buttons on mobile (< 640px).
48
+ 3. **Item 4 & Item 5:** Refine breakpoints and tap targets across 320px, 390px, 502px, and 768px so layout stays resilient without horizontal scroll or target collision.
49
+ 4. **Verification:** Test via Chrome DevTools at 390x844 (mobile), 502px, and 768px with screenshot proof and DevTools computed metrics.
50
+
51
+ ---
52
+
53
+ ## Follow-Up Implementation & Verification Report
54
+
55
+ - **Approval:** User approved fixing all findings (1, 2, 3, 4, 5).
56
+ - **Execution Date:** 2026-10-11
57
+ - **Status:** FIXED & VERIFIED
58
+
59
+ ### Modifications Implemented:
60
+ 1. **[frontend/src/styles/base.css](file:///c:/Users/Administrator/Documents/PROJECT-GITHUB/quote-api/frontend/src/styles/base.css):**
61
+ - Set `.brand { flex-shrink: 0; }` preventing brand crushing on narrow viewports.
62
+ - Refactored media queries (`max-width: 768px`, `max-width: 640px`, `max-width: 480px`, `max-width: 360px`).
63
+ - Reflowed secondary desktop buttons (`.whatsapp-btn`, `.nav-link-btn`) out of the mobile header row into `.nav-links`.
64
+ - Optimized mobile header controls: `#apiStatusBadge` compacts to 42x42px status dot box with accessible tooltip, `#themeToggleBtn` (42x42px), and `#mobileMenuBtn` (42x42px) with 0.5rem comfortable spacing.
65
+ 2. **[frontend/index.html](file:///c:/Users/Administrator/Documents/PROJECT-GITHUB/quote-api/frontend/index.html):**
66
+ - Added `.mobile-nav-divider`, `.mobile-drawer-wa`, and `.mobile-drawer-github` inside `.nav-links` so WhatsApp and GitHub remain accessible within the mobile drawer menu.
67
+ 3. **[frontend/src/main.js](file:///c:/Users/Administrator/Documents/PROJECT-GITHUB/quote-api/frontend/src/main.js):**
68
+ - Dynamically synchronized `apiStatusBadge.title` for mobile accessibility when text is hidden.
69
+
70
+ ### Verification Evidence:
71
+ - **Chrome DevTools (390x844 - iPhone Mobile):**
72
+ - `hasHorizontalOverflow`: `false` (0px overflow)
73
+ - `navbarScrollWidth`: 363px vs `navbarClientWidth`: 363px
74
+ - Brand to actions spacing: 63.5px buffer (no collision)
75
+ - Drawer open: All 6 options render with min-height >= 44px
76
+ - **Chrome DevTools (320x568 - iPhone SE Compact):**
77
+ - `hasHorizontalOverflow`: `false` (0px overflow)
78
+ - **Chrome DevTools (1280x800 - Desktop):**
79
+ - `hasHorizontalOverflow`: `false`, full desktop links and buttons intact
80
+ - **Production Build:**
81
+ - `npm run build` -> `built in 107ms`, 0 errors, 0 warnings
82
+
frontend/index.html CHANGED
@@ -175,6 +175,25 @@
175
  <a href="#api-docs" class="nav-anchor">API Endpoints</a>
176
  <a href="#specs" class="nav-anchor">Formats</a>
177
  <a href="#faq" class="nav-anchor">FAQ</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </nav>
179
 
180
  <div class="nav-actions">
 
175
  <a href="#api-docs" class="nav-anchor">API Endpoints</a>
176
  <a href="#specs" class="nav-anchor">Formats</a>
177
  <a href="#faq" class="nav-anchor">FAQ</a>
178
+ <div class="mobile-nav-divider"></div>
179
+ <a href="https://wa.me/6281233649676?text=Halo%20Mang%20Rusdi%2C%20saya%20tertarik%20dengan%20Quote%20Studio%20API"
180
+ target="_blank" rel="noopener noreferrer" class="nav-anchor mobile-drawer-btn mobile-drawer-wa" data-track="click_wa"
181
+ title="Chat Developer via WhatsApp">
182
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
183
+ <path
184
+ d="M12.04 2c-5.46 0-9.91 4.45-9.91 9.91 0 1.75.46 3.45 1.32 4.95L2.05 22l5.25-1.38c1.45.79 3.08 1.21 4.74 1.21 5.46 0 9.91-4.45 9.91-9.91 0-2.65-1.03-5.14-2.9-7.01A9.816 9.816 0 0 0 12.04 2m.01 1.67c2.2 0 4.26.86 5.82 2.41a8.176 8.176 0 0 1 2.41 5.83c0 4.54-3.7 8.24-8.24 8.24-1.48 0-2.93-.4-4.2-1.15l-.3-.18-3.12.82.83-3.04-.2-.31a8.21 8.21 0 0 1-1.26-4.38c0-4.54 3.7-8.24 8.24-8.24m4.52 11.53c-.25-.13-1.47-.72-1.7-.81-.23-.08-.39-.13-.56.13-.17.25-.64.81-.79.97-.14.17-.29.19-.54.06-.25-.13-1.06-.39-2.02-1.25-.75-.67-1.26-1.5-1.41-1.75-.14-.25-.02-.39.11-.51.11-.11.25-.29.38-.44.12-.14.17-.25.25-.42.08-.17.04-.31-.02-.44-.06-.13-.56-1.34-.76-1.84-.2-.48-.41-.42-.56-.43h-.48c-.17 0-.44.06-.67.31-.23.25-.88.86-.88 2.1s.9 2.44 1.03 2.61c.12.17 1.77 2.7 4.29 3.79.6.26 1.07.41 1.44.53.6.19 1.15.16 1.58.1.48-.07 1.47-.6 1.68-1.18.21-.58.21-1.07.15-1.18-.06-.11-.23-.17-.48-.29z" />
185
+ </svg>
186
+ <span>Chat via WhatsApp</span>
187
+ </a>
188
+ <a href="https://github.com/RusdiEneri/quote" target="_blank" rel="noopener noreferrer"
189
+ class="nav-anchor mobile-drawer-btn mobile-drawer-github" title="GitHub Repository">
190
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
191
+ <path
192
+ d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22">
193
+ </path>
194
+ </svg>
195
+ <span>GitHub Repository</span>
196
+ </a>
197
  </nav>
198
 
199
  <div class="nav-actions">
frontend/src/main.js CHANGED
@@ -180,12 +180,14 @@ async function checkApiStatus() {
180
  const data = await res.json();
181
  apiStatusBadge.className = 'status-badge online';
182
  apiStatusText.textContent = 'API Space Online';
 
183
  } else {
184
  throw new Error('Non-200 status');
185
  }
186
  } catch (err) {
187
  apiStatusBadge.className = 'status-badge checking';
188
  apiStatusText.textContent = 'HF Space Sleeping / Ready';
 
189
  }
190
  }
191
 
 
180
  const data = await res.json();
181
  apiStatusBadge.className = 'status-badge online';
182
  apiStatusText.textContent = 'API Space Online';
183
+ apiStatusBadge.title = 'API Space Online';
184
  } else {
185
  throw new Error('Non-200 status');
186
  }
187
  } catch (err) {
188
  apiStatusBadge.className = 'status-badge checking';
189
  apiStatusText.textContent = 'HF Space Sleeping / Ready';
190
+ apiStatusBadge.title = 'HF Space Sleeping / Ready';
191
  }
192
  }
193
 
frontend/src/styles/base.css CHANGED
@@ -140,7 +140,7 @@ body {
140
  text-decoration: none;
141
  color: inherit;
142
  min-width: 0;
143
- flex-shrink: 1;
144
  }
145
 
146
  .brand-logo {
@@ -232,6 +232,12 @@ body {
232
  box-shadow: 0px 0px 0px var(--shadow-color);
233
  }
234
 
 
 
 
 
 
 
235
  /* Nav Actions */
236
  .nav-actions {
237
  display: flex;
@@ -541,14 +547,59 @@ body {
541
  font-size: 0.95rem;
542
  }
543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  .mobile-menu-btn {
545
  display: inline-flex;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  }
547
 
548
  .navbar {
549
  position: relative;
550
  padding: 1rem 0;
551
  margin-bottom: 1.5rem;
 
552
  }
553
  }
554
 
@@ -573,26 +624,60 @@ body {
573
  .nav-actions {
574
  gap: 0.5rem;
575
  }
576
- }
577
 
578
- @media (max-width: 480px) {
579
  #apiStatusBadge .status-text {
580
  display: none;
581
  }
582
 
583
  #apiStatusBadge {
584
  padding: 0.4rem 0.55rem;
585
- min-height: 40px;
 
 
 
 
586
  }
 
587
 
588
- .nav-link-btn span {
 
589
  display: none;
590
  }
591
 
592
- .nav-link-btn {
593
- padding: 0.4rem 0.6rem;
594
- min-width: 42px;
595
- justify-content: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  }
597
  }
598
 
 
140
  text-decoration: none;
141
  color: inherit;
142
  min-width: 0;
143
+ flex-shrink: 0;
144
  }
145
 
146
  .brand-logo {
 
232
  box-shadow: 0px 0px 0px var(--shadow-color);
233
  }
234
 
235
+ /* Mobile Drawer Elements (Desktop Hidden) */
236
+ .mobile-nav-divider,
237
+ .nav-links .mobile-drawer-btn {
238
+ display: none;
239
+ }
240
+
241
  /* Nav Actions */
242
  .nav-actions {
243
  display: flex;
 
547
  font-size: 0.95rem;
548
  }
549
 
550
+ .mobile-nav-divider {
551
+ display: block;
552
+ height: 2px;
553
+ background: var(--border-color);
554
+ margin: 0.35rem 0;
555
+ opacity: 0.25;
556
+ }
557
+
558
+ .nav-links .mobile-drawer-btn {
559
+ display: flex;
560
+ align-items: center;
561
+ gap: 0.65rem;
562
+ font-weight: 700;
563
+ }
564
+
565
+ .nav-links .mobile-drawer-wa {
566
+ background: #25D366;
567
+ color: #000000;
568
+ }
569
+
570
+ .nav-links .mobile-drawer-wa:hover {
571
+ background: #20BA5A;
572
+ color: #000000;
573
+ }
574
+
575
+ .nav-links .mobile-drawer-github {
576
+ background: var(--bg-card);
577
+ color: var(--text-primary);
578
+ }
579
+
580
  .mobile-menu-btn {
581
  display: inline-flex;
582
+ align-items: center;
583
+ justify-content: center;
584
+ width: 42px;
585
+ height: 42px;
586
+ min-width: 42px;
587
+ min-height: 42px;
588
+ border-radius: var(--radius-sm);
589
+ cursor: pointer;
590
+ }
591
+
592
+ /* Reflow secondary actions into mobile drawer to free header row */
593
+ .nav-actions .whatsapp-btn,
594
+ .nav-actions .nav-link-btn {
595
+ display: none;
596
  }
597
 
598
  .navbar {
599
  position: relative;
600
  padding: 1rem 0;
601
  margin-bottom: 1.5rem;
602
+ gap: 0.75rem;
603
  }
604
  }
605
 
 
624
  .nav-actions {
625
  gap: 0.5rem;
626
  }
 
627
 
 
628
  #apiStatusBadge .status-text {
629
  display: none;
630
  }
631
 
632
  #apiStatusBadge {
633
  padding: 0.4rem 0.55rem;
634
+ min-height: 42px;
635
+ min-width: 42px;
636
+ width: 42px;
637
+ height: 42px;
638
+ justify-content: center;
639
  }
640
+ }
641
 
642
+ @media (max-width: 480px) {
643
+ .brand-tag {
644
  display: none;
645
  }
646
 
647
+ .brand-title {
648
+ font-size: 1.1rem;
649
+ }
650
+
651
+ .nav-actions {
652
+ gap: 0.45rem;
653
+ }
654
+ }
655
+
656
+ @media (max-width: 360px) {
657
+ .app-layout {
658
+ padding: 0 0.65rem 1.75rem;
659
+ }
660
+
661
+ .brand-logo {
662
+ width: 34px;
663
+ height: 34px;
664
+ }
665
+
666
+ .brand-title {
667
+ font-size: 0.95rem;
668
+ }
669
+
670
+ .nav-actions {
671
+ gap: 0.35rem;
672
+ }
673
+
674
+ .theme-toggle-btn,
675
+ .mobile-menu-btn,
676
+ #apiStatusBadge {
677
+ width: 38px;
678
+ height: 38px;
679
+ min-width: 38px;
680
+ min-height: 38px;
681
  }
682
  }
683