Skip to content

Commit 92a16e9

Browse files
feat: strengthen Screen 9 justification validation to 12 chars + two-word minimum
- Replaces the 5-char floor with: length >= 12 AND includes at least one space, preventing single-word garbage responses (e.g. "idk", "good") from passing - Displays inline hint 'Please provide a brief, complete sentence.' when input is non-empty but does not yet meet the criteria - Adds #justification-hint <p> element to index.html (Screen 9) - Adds .input-hint style (amber, 0.8rem) to style.css - Caches justificationHint in experiment.js DOM map - Updates METHODS.md Data Quality section to reflect new threshold Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5e840df commit 92a16e9

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

code/experiment.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ const DOM = {
289289
trialCounter: document.getElementById('trial-counter'),
290290
progressFill: document.getElementById('progress-fill'),
291291
textareaJustification: document.getElementById('semantic-justification'),
292+
justificationHint: document.getElementById('justification-hint'),
292293
btnFinalize: document.getElementById('btn-finalize'),
293294
syncStatus: document.getElementById('sync-status'),
294295
finalActions: document.getElementById('final-actions'),
@@ -343,8 +344,17 @@ function init() {
343344
});
344345

345346
// Screen 9 Events
347+
// NOTE: The threshold (12 chars + at least one space) is intentional and must NOT be raised further.
348+
// A higher threshold increases study abandonment at the final screen, immediately
349+
// before the Firebase payload fires. Low-effort responses are expected and will be
350+
// filtered analytically via cosine-similarity scoring during NLP post-processing.
346351
DOM.textareaJustification.addEventListener('input', (e) => {
347-
DOM.btnFinalize.disabled = e.target.value.trim().length < 5;
352+
const val = e.target.value.trim();
353+
const valid = val.length >= 12 && val.includes(' ');
354+
DOM.btnFinalize.disabled = !valid;
355+
DOM.justificationHint.textContent = val.length > 0 && !valid
356+
? 'Please provide a brief, complete sentence.'
357+
: '';
348358
});
349359

350360
DOM.btnFinalize.addEventListener('click', () => {

code/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ <h2>Strategic Rationalization</h2>
106106
<p class="instruction">In one sentence, what was your primary strategy for choosing between the layouts?</p>
107107

108108
<textarea id="semantic-justification" placeholder="My strategy was based on..." maxlength="280"></textarea>
109+
<p id="justification-hint" class="input-hint"></p>
109110

110111
<button id="btn-finalize" class="btn-primary" disabled>Complete Diagnostic</button>
111112
</div>

code/style.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,21 @@ textarea {
295295
font-family: inherit;
296296
font-size: 1rem;
297297
resize: none;
298-
margin-bottom: 1.5rem;
298+
margin-bottom: 0.4rem;
299299
outline: none;
300300
transition: border-color 0.3s ease;
301301
}
302302

303303
textarea:focus { border-color: var(--accent-blue); }
304304

305+
.input-hint {
306+
min-height: 1.1rem;
307+
margin: 0 0 1rem;
308+
font-size: 0.8rem;
309+
color: #f5a623;
310+
text-align: left;
311+
}
312+
305313
/* --- Screen 10: Outro --- */
306314
.success-card { text-align: center; }
307315
.success-icon {

docs/METHODS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Each pair shared identical layout and functionality, differing only in a single
7575

7676
### Semantic Justification Field (Screen 9)
7777

78-
The in-app UI enforces a 5-character minimum on the free-text justification input before the "Complete Diagnostic" button is enabled. This threshold was intentionally set low to avoid study abandonment at the final step immediately before the Firebase payload fires — a higher character floor would increase drop-off without meaningfully improving response quality.
78+
The in-app UI enforces a minimum of 12 characters **and** at least one space (requiring a minimum of two words) on the free-text justification input before the "Complete Diagnostic" button is enabled. If the input does not meet these criteria, the UI displays: *"Please provide a brief, complete sentence."* This threshold was set to discourage single-word garbage responses (e.g., "idk", "good") while remaining low enough to avoid study abandonment at the final step immediately before the Firebase payload fires.
7979

8080
**Known risk:** Mobile keyboard friction will motivate a subset of participants to satisfy the minimum with low-effort, non-informative responses (e.g., "idk", "good", "it looked better").
8181

0 commit comments

Comments
 (0)