makeSelect function infrastructure

Last updated: 2026-03-02T13:35:57.085Z

Signature

makeSelect(options?: { disabled?: boolean; placeholder?: string; hasOptions?: boolean; }): : HTMLElement

Source Code

function makeSelect(options?: {
  disabled?: boolean;
  placeholder?: string;
  hasOptions?: boolean;
}): HTMLElement {
  const wrapper = document.createElement("div");
  wrapper.className = "ant-select ant-select-single";
  if (options?.disabled) wrapper.classList.add("ant-select-disabled");

  const selector = document.createElement("div");
  selector.className = "ant-select-selector";

  const searchSpan = document.createElement("span");
  searchSpan.className = "ant-select-selection-search";

  const input = document.createElement("input");
  input.setAttribute("role", "combobox");
  input.className = "ant-select-selection-search-input";

  if (options?.placeholder) {
    const placeholder = document.createElement("span");
    placeholder.className = "ant-select-selection-placeholder";
    placeholder.textContent = options.placeholder;
    selector.appendChild(placeholder);
  }

  searchSpan.appendChild(input);
  selector.appendChild(searchSpan);
  wrapper.appendChild(selector);

  if (options?.hasOptions) {
    // Create a fake listbox with aria-controls
    const listboxId = "antd-listbox-test";
    input.setAttribute("aria-controls", listboxId);

    const listbox = document.createElement("ul");
    listbox.id = listboxId;
    listbox.setAttribute("role", "listbox");

    const opt1 = document.createElement("li");
    opt1.setAttribute("role", "option");
    opt1.setAttribute("title", "Opção 1");
    opt1.textContent = "Opção 1";

    const opt2 = document.createElement("li");
    opt2.setAttribute("role", "option");
    opt2.setAttribute("title", "Opção 2");
    opt2.textContent = "Opção 2";

    listbox.appendChild(opt1);
    listbox.appendChild(opt2);
    document.body.appendChild(listbox);
  }

  return wrapper;
}

Dependencies (Outgoing)

graph LR makeSelect["makeSelect"] waitForElement["waitForElement"] makeNewCssVarSelect["makeNewCssVarSelect"] makeMultipleSelect["makeMultipleSelect"] makeDropdownWithOptions["makeDropdownWithOptions"] makeDatepicker["makeDatepicker"] makeTimePicker["makeTimePicker"] makeSlider["makeSlider"] makeSelect -->|uses| waitForElement makeSelect -->|calls| makeSelect makeSelect -->|calls| makeNewCssVarSelect makeSelect -->|calls| makeMultipleSelect makeSelect -->|calls| makeDropdownWithOptions makeSelect -->|calls| makeDatepicker makeSelect -->|calls| makeTimePicker makeSelect -->|calls| makeSlider style makeSelect fill:#dbeafe,stroke:#2563eb,stroke-width:2px click makeSelect "75e6fe1e0954bfa2.html" click waitForElement "230bbf0882ca7c81.html" click makeNewCssVarSelect "38b215aee5d1aa7d.html" click makeMultipleSelect "696583f6e887ec7b.html" click makeDropdownWithOptions "d7eb86a88be44b39.html" click makeDatepicker "70402d74c7a9e9e5.html" click makeTimePicker "112731eec9cde90e.html" click makeSlider "c635b8855509a9b4.html"

Impact (Incoming)

graph LR makeSelect["makeSelect"] makeMultipleSelect["makeMultipleSelect"] makeSelect -->|calls| makeSelect makeMultipleSelect -->|calls| makeSelect style makeSelect fill:#dbeafe,stroke:#2563eb,stroke-width:2px click makeSelect "75e6fe1e0954bfa2.html" click makeMultipleSelect "696583f6e887ec7b.html"
SourceType
makeSelect calls
makeMultipleSelect calls