Skip to content

fix(author): a Drag and Drop's boxes are laid out by the build (#295) - #296

Merged
alekswebnet merged 4 commits into
mainfrom
fix/drag-question-layout
Nov 27, 2026
Merged

alekswebnet merged 4 commits into
mainfrom
fix/drag-question-layout

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #295.

A Drag and Drop built in a chat played with its words stacked over each other and over the zones. Its boxes are placed by x and y in percent of the task and sized by width and height in em, and a model wrote all four as percent. Now the build lays the boxes out itself, and a model is told to leave the four out.

What changes

  • The build lays out a Drag and Drop's boxes that have no place (dragQuestion in lib/types.mjs). Words go in centred rows, shared evenly (3 and 2, not 4 and 1), each as wide as its text. Zones go below, as wide as their labels and tall enough for the words right in them. The task grows as tall as they need. Boxes placed by hand keep their places, and the rest go below them. The sizes come from the player: per-character text widths, a draggable's 1.55 by 0.75 em of handle and padding, and a zone's label drawn 1.25 em above its box, all measured in H5P.DragQuestion 1.15.
  • A zone the build lays out shows its label when no background picture is under it, since nothing else tells it apart. A showLabel the source writes is kept.
  • One note when written boxes run past the task or over each other: it names them and gives the units. Zones on a background picture get the "placed by numbers" note that hotspots get.
  • The field list leaves out the four layout fields, as it does for Course Presentation. A new type file, H5P.DragQuestion.md, says to leave them out, and when to write them: zones on a picture. The skill's table lists the type.
  • A group's default keeps only its fields. The build wrote size.field: "background", the dimensions widget's own setting, which the content check removes. Every Drag and Drop with no size written carried it.

Tested

  • Unit tests: author's 305 pass, 4 of them new. They check that laid-out boxes stay inside the task and never overlap, words above zones; that placed boxes are kept and a written showLabel: false stays; that the reported content gets one note; and the picture note. Typecheck and pnpm comments pass, and sync:skill --check finds every type file current.
  • The type file's example builds, checks as saved content unchanged, and plays trusted and untrusted without warnings (apps/skills).
  • Played: the reported content with its places left out lays out as words above zones. A word dragged into a zone fits with room around it.
  • Haiku, route 1, a build archive from this branch: asked for "an H5P Drag & Drop with 5 random questions about English vocabulary". It left the places out in 5 of 5 runs, and the 3 played had no box over another and every label whole.

Summary by cubic

Fixes Drag and Drop layout so generated boxes no longer stack on each other or the task's zones. The build now places unplaced words and zones itself in rows, growing the task to fit, instead of relying on the model's percent-based coordinates.

  • Words go in centred rows above zones, sized by their text; zones are wide enough for their labels and the words right in them.
  • Boxes placed by hand keep their places, and laid-out rows go below them; a y written in percent stays in the written pixels, not the grown task's height.
  • Boxes without a written size get sized even when already placed.
  • Zones on a background picture keep the "placed by numbers" note; all laid-out boxes are checked for running past the task or overlapping, with one note naming offenders.
  • Models are told to leave x, y, width, and height out unless placing zones on a picture, via the new H5P.DragQuestion.md type file.
  • Group defaults now keep only the group's own fields, dropping widget-driven values like size.field.

Written for commit 520913a. Summary will update on new commits.

View guided diff Turn on auto-fix

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/author/lib/types.mjs Resolved
Comment thread design/author.md Resolved
Comment thread design/author.md Resolved
Comment thread packages/author/lib/types.mjs Resolved
…, rows of other widths, the label and width wording)

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/author/lib/types.mjs Resolved
Comment thread design/author.md Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

You’re at about 90% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@alekswebnet
alekswebnet merged commit 88f9a32 into main Nov 27, 2026
11 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.

h5p-author: Drag and Drop boxes overlap, since a model gets x, y, width and height with no units

1 participant