Select Element to List Converter — Transform HTML Select to UL/LI
Convert HTML select elements into accessible, styleable unordered lists. Generate clean vanilla JS, CSS, and HTML code with live preview.
About
Native <select> elements offer limited styling control across browsers. Border radius, padding, option height, font styling, and background colors render inconsistently between Chrome, Firefox, and Safari. This converter transforms a standard <select> into a semantic <ul>/<li> structure with full ARIA attributes (role="listbox", aria-selected, aria-expanded) preserved. The generated code requires zero external dependencies. It handles keyboard navigation (Arrow keys, Enter, Escape), click-outside dismissal, and screen reader announcements natively.
Failure to implement proper ARIA roles when replacing native form controls breaks accessibility compliance under WCAG 2.1 SC 4.1.2 (Name, Role, Value). This tool generates the complete accessible markup so the converted list behaves identically to a native select for assistive technology users. The output includes a hidden <input type="hidden"> that syncs the selected value for form submission compatibility. Note: this approach approximates native select behavior. Edge cases like <optgroup> nesting and mobile OS-level select pickers are not replicated.
Formulas
The conversion algorithm maps each child element of the source <select> to a corresponding list node:
Where vi = the value attribute of option i, and ti = the textContent of option i. The selected state is tracked via a state variable s where s ∈ {v0, v1, … vn}.
The hidden input synchronization rule ensures form compatibility:
ARIA state propagation follows:
Reference Data
| Feature | Native <select> | Converted <ul> List |
|---|---|---|
| Custom font styling | Partial (varies by OS) | Full control |
| Custom option height | Not supported | Full control via CSS |
| Background colors per option | Limited (Firefox only) | Full control |
| Border radius | Outer only | Inner and outer |
| Animations / transitions | None | CSS transitions supported |
| Icons inside options | Not supported | HTML content allowed |
| Search / filter | Not native | Implementable |
| Keyboard navigation | Native (Arrow, Enter) | Must implement manually |
| Screen reader support | Native role="listbox" | Requires explicit ARIA attrs |
| Form submission | Native name/value | Hidden input sync required |
| Mobile native picker | OS-level picker | Not available (custom dropdown) |
| <optgroup> support | Native | Must implement as nested list |
| multiple attribute | Native multi-select | Checkbox list pattern |
| Cross-browser consistency | Low (major differences) | High (CSS-controlled) |
| Tab order / focus | Native tabindex | Requires tabindex="0" |
| disabled state | Native attribute | aria-disabled="true" + CSS |
| required validation | Native constraint | Custom validation logic |
| Max visible options | size attribute | max-height + overflow-y |
| Right-to-left (RTL) | Inherited from dir | Must set dir="rtl" on container |
| Print rendering | Shows selected value | Shows selected value (with print CSS) |