Skip to content

Require editable inputs in writable activity sections#294

Merged
elasticsounds merged 5 commits intomainfrom
elasticsounds/editable-inputs
Apr 19, 2026
Merged

Require editable inputs in writable activity sections#294
elasticsounds merged 5 commits intomainfrom
elasticsounds/editable-inputs

Conversation

@elasticsounds
Copy link
Copy Markdown
Contributor

Summary

  • Validator now fails activity_open_ended_answer, activity_fill_in_the_blank, and activity_fill_in_a_table sections that lack any editable element (textarea, writable input, or [[blank:item-N]] marker), so the LLM can't ship pages where the learner can't type.
  • Permit the LLM to strip textbook blank placeholders (___ or ...) from label text when it emits a separate editable element, and skip text replacement on data-id elements containing nested editables so they aren't destroyed.
  • Updated prompts add a label-plus-separate-input pattern (good for "Nombre:" / date-style fields), require one textarea per response field, drop the hardcoded Spanish placeholder, and add a writable-page precedence rule to page sectioning.

Test plan

  • pnpm --filter @adt/pipeline test (covers new writable-section, placeholder-stripping, input-type-filtering, and nested-editable-preservation cases)
  • Re-run the renderer against a book with form-style pages (e.g. labelled "Nombre:" fields and open-ended response lines) and confirm textareas/inputs are emitted instead of decorative underlines

Validate that activity_open_ended_answer, activity_fill_in_the_blank,
and activity_fill_in_a_table sections contain at least one <textarea>,
writable <input>, or [[blank:item-N]] marker — fail loudly when the LLM
emits only static underlines so the renderer retries. Permit the LLM to
strip textbook blank placeholders (___ or ...) from label text when it
emits a separate editable element, and skip text replacement on data-id
elements containing nested editables so they aren't destroyed. Update
prompts to add a label-plus-separate-input pattern for form-style labels,
require one textarea per response field for open-ended answers, drop the
hardcoded Spanish placeholder text, and add a writable-page precedence
rule to page sectioning.
- Sectioning: classify labeled ID forms (Nombre/Apellido/Fecha/Lugar)
  and determinable prompts (unscramble, count syllables/letters) as
  fill-in-the-blank based on response STRUCTURE, not on whether the
  answer is gradable. Detect empty boxes as blanks, not just underlines.
- Open-ended answer: allow <input type="text"> for short single-line
  fields so one-line textareas don't push text above the baseline.
  Add ruled-paper styling scoped to open-ended textareas. Instruct
  wrapping decorative separators (/, -) in aria-hidden spans.
- Validator: treat content inside aria-hidden="true" ancestors as
  exempt from the data-id requirement, and always strip textbook
  blank placeholders (___, ...) when the LLM emits a separate
  editable element so underscores never render beside an input.
@elasticsounds elasticsounds force-pushed the elasticsounds/editable-inputs branch from d7b488c to 74cbf87 Compare April 18, 2026 15:04
Prompt now routes single-word missing-letter sources (e.g. "en_ro") to
pattern 2 with one marker per underscore, and date/phone split fields to
pattern 2b with separators living between inputs instead of inside the
label. Validator strips orphan `/` and `-` runs left behind after
removing `___` placeholders, and ignores single underscores when
comparing inline-letter blanks to their source text. Runtime hydration
sizes each blank to the known answer length + 1 (via
window.correctAnswers), falling back to a narrow word-internal slot when
no answer is available.
The adt-preview route only rebuilt base.bundle.min.js when the file was
missing, so edits under assets/adt/modules/** were silently ignored when
a stale bundle already existed on disk. Compare the bundle's mtime to
the max mtime of base.js + modules/** and rebuild when the sources are
newer. Skipped when ADT_RESOURCES_ZIP is set so packaged builds (where
esbuild isn't available inside the pkg'd binary) still serve the
pre-built bundle as-is.
text-2xl in the inline-letter-blanks example caused long words like
_eptiembr_ to wrap inside multi-column grids on desktop while mobile
looked fine. Default to text-lg and add explicit guidance to avoid
text-2xl+ in multi-column layouts.
@elasticsounds elasticsounds merged commit c923a38 into main Apr 19, 2026
3 checks passed
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.

1 participant