Interactive Exercises (Drag-Drop, Fill-in-Blank) for LMS

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1215
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1043
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Building Interactive Exercises (drag-drop, fill-in-blank) for LMS

Interactive exercises keep student attention better than passive reading and standard multiple-choice tests. Drag-and-drop, fill-in-the-blank, sorting, matching — all boost engagement and improve retention through active recall.

Types of Interactive Exercises

Drag-and-drop — dragging elements:

  • Sorting: arrange algorithm steps in correct order
  • Matching: connect concept with definition
  • Schema filling: drag labels onto diagram

Fill-in-the-blank — fill gaps in text or code

Hotspot — click correct area of image

Matching pairs — find card pairs (memory game)

Code arrangement — assemble working code from scrambled lines

Technologies

dnd-kit — recommended for React. Accessibility out of the box (keyboard navigation), excellent performance, flexible architecture:

import { DndContext, useDraggable, useDroppable, closestCenter } from '@dnd-kit/core';
import { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';

interface SortableItem {
  id: string;
  content: string;
}

function SortableExercise({ items, onComplete }: { items: SortableItem[]; onComplete: (order: string[]) => void }) {
  const [activeItems, setActiveItems] = useState(shuffle(items));

  const handleDragEnd = (event: DragEndEvent) => {
    const { active, over } = event;
    if (!over || active.id === over.id) return;

    setActiveItems(prev => {
      const oldIndex = prev.findIndex(i => i.id === active.id);
      const newIndex = prev.findIndex(i => i.id === over.id);
      return arrayMove(prev, oldIndex, newIndex);
    });
  };

  const checkAnswer = () => {
    const currentOrder = activeItems.map(i => i.id);
    const correctOrder = items.map(i => i.id);
    const isCorrect = currentOrder.every((id, idx) => id === correctOrder[idx]);
    onComplete(currentOrder);
    return isCorrect;
  };

  return (
    <DndContext onDragEnd={handleDragEnd} collisionDetection={closestCenter}>
      <SortableContext items={activeItems} strategy={verticalListSortingStrategy}>
        {activeItems.map(item => <SortableItemCard key={item.id} item={item} />)}
      </SortableContext>
      <button onClick={checkAnswer}>Check</button>
    </DndContext>
  );
}

Fill-in-the-blank

function FillInBlankExercise({ template, answers }: { template: string; answers: Record<string, string> }) {
  const [userAnswers, setUserAnswers] = useState<Record<string, string>>({});

  const parts = template.split(/(\{\{[^}]+\}\})/g);

  return (
    <div className="exercise-text">
      {parts.map((part, idx) => {
        const match = part.match(/^\{\{(.+)\}\}$/);
        if (match) {
          const fieldId = match[1];
          return (
            <input
              key={idx}
              className="blank-input"
              style={{ width: `${Math.max(answers[fieldId]?.length * 10, 80)}px` }}
              value={userAnswers[fieldId] || ''}
              onChange={e => setUserAnswers(prev => ({ ...prev, [fieldId]: e.target.value }))}
              onBlur={() => checkSingleBlank(fieldId, userAnswers[fieldId], answers[fieldId])}
            />
          );
        }
        return <span key={idx}>{part}</span>;
      })}
    </div>
  );
}

Exercise Data Structure

interface Exercise {
  id: string;
  type: 'sort' | 'fill-blank' | 'match' | 'hotspot' | 'code-arrange';
  title: string;
  description?: string;
  content: ExerciseContent;
  hints?: string[];
  maxAttempts?: number;
  points: number;
}

interface SortExercise extends Exercise {
  type: 'sort';
  content: {
    items: { id: string; text: string }[];
    correctOrder: string[];
    explanation?: string;
  };
}

Exercise Editor for Teachers

Drag-and-drop constructor where teachers create exercises without code:

  • Add elements via form
  • Drag to set correct order
  • Preview in student mode
  • Bulk import from Excel

Save Progress

const saveProgress = debounce(async (exerciseId, answers) => {
  await api.post(`/exercises/${exerciseId}/save-draft`, { answers });
}, 2000);

async function submitExercise(exerciseId, answers) {
  const result = await api.post(`/exercises/${exerciseId}/submit`, { answers });
  return result;
}

Timeline

Drag-and-drop sorting with answer checking — 3–4 days. Fill-in-the-blank with template parser — 2–3 days. Matching pairs and hotspot — 3–4 days. Exercise editor for teachers — 5–7 days.