← Craft adatlapja
AgentCraft
Akadálymentes átrendezés
Ellenőrzött célhellyel, megszakítható húzással és egyenértékű billentyűművelettel teszi megbízhatóvá az átrendezést és famozgatást.
drag-and-drop-reordering
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha blokkokat, leckéket vagy beágyazott elemeket rendeznek, és a húzás önmagában kevés.
Miben segít neked?
- Ellenőrzi a célhelyet és tiltja az érvénytelen fabeágyazást.
- Húzás mellett billentyűzetes mozgatást és megszakítást biztosít.
- Felolvashatóan jelzi a mozgatást, összehangolja a görgetést és fókuszt.
Például ezt kérheted
Rendezz át egymásba ágyazott leckéket húzással és billentyűzetes menüvel. Mozgass leckét modulok között, majd próbálj modult önmagába helyezni. Maradjon meg a fókusz, hangozzon el az új hely, a hibás beágyazás legyen tiltott.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Drag-and-Drop & Reordering
Use this skill when building sortable block lists, nested tree reordering, column/layout builders, or palette-to-canvas drag-and-drop interactions.
Core Interaction & Tree Validation Rules
- Validate Drop Targets Against the Document Schema:
- Before showing a positive drop indicator or committing a move, verify:
- Cycle Prevention: A parent container can never be dropped inside itself or any of its own descendants.
- Allowed Parent-Child Types: Check whether the target container permits the dragged block type and whether maximum nesting depth would be exceeded.
- Clear Drop Zones: Distinguish
before,after, andinside(reparenting/indenting) drop zones visually using horizontal/vertical pointer displacement and clear indicator lines.
- Before showing a positive drop indicator or committing a move, verify:
- Smooth Auto-Scroll, Touch & Cancellation:
- Auto-Scrolling: Automatically scroll the nearest scrollable editor container (and window if needed) when the pointer approaches top/bottom/side edges during a drag.
- Clean Cancellation: Pressing
Escape, losing window focus (blur), or releasing over an invalid drop zone must abort the drag cleanly and restore the exact pre-drag layout without pushing an entry to the undo stack. - Touch & Pointer Activation Constraints: Require a small distance threshold (e.g.,
4–8 px) or long-press delay (150–200 mson touch) or dedicated drag handle so normal text selection, clicking, and mobile scrolling are never hijacked by accidental drags.
- Commit as a Single Atomic Transaction:
- Keep visual drag previews in ephemeral UI state during pointer movement and dispatch a single document move/reparent command on
drop.
- Keep visual drag previews in ephemeral UI state during pointer movement and dispatch a single document move/reparent command on
Mandatory Keyboard & Accessible Alternatives
Pointer drag-and-drop must never be the only way to reorder or move blocks:
- Provide explicit keyboard reordering shortcuts (e.g.,
Alt/Opt + ArrowUp/ArrowDownorCmd/Ctrl + Shift + ArrowUp/ArrowDownto move blocks up/down,Tab/Shift+Tabor indent/outdent commands to change nesting level). - Or provide an accessible block action menu ("Move up", "Move down", "Move into…") plus keyboard sensor support (
Space/Enterto pick up, arrow keys to move,Space/Enterto drop,Escapeto cancel). - Announce drag start, current target position, drop completion, and cancellation via
aria-livepolite announcements.
Checklist
- Does drop validation block ancestor-into-descendant cycles and disallowed parent-child block types?
- Do edge auto-scrolling,
Escapecancellation, and touch/click activation thresholds work reliably? - Does dropping commit a single atomic transaction to the document model and undo history?
- Is there a complete keyboard and screen-reader alternative for every drag-and-drop reordering operation?
Csomagban lévő fájlok 1
SKILL.md
