v6: allow combobox to be built from native form elements

Abierto
#43,357 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
html, javascript

Línea de trabajo

Start by comparing the proposed native input-and-datalist markup with the existing v6 Forms combobox example linked in the issue. Determine the scope needed for JavaScript to support this simpler markup while retaining the current customizable syntax; done means the API and required accessibility behavior are agreed, since the issue does not specify implementation files or tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

docs feature html js needs-decision v6
Prerequisites
Proposal

Maybe this is too big a change since we're already in alpha, but I just tried the new combobox form component out today. I noticed that it's extremely verbose, but also that it's really just a well-styled version of an <input> with a <datalist>.

Since this is a JS-powered component, there's no need for the base markup to be so verbose. IMO having markup something like the following would be preferable to the example given in the docs.

<div class="form-field">
    <label for="country">Combobox</label>
    <input name="country" id="country" class="combobox-input" list="countryList" placeholder="Select a country…"/>
    <datalist id="countryList">
        <option value="au">Australia</option>
        <option value="ca">Canada</option>
        <option value="uk">United Kingdom</option>
    </datalist>
</div>

Given that HTML, the JavaScript can hook onto the .combobox-input class to build the menu structure, trigger button/caret SVG, and (optional) search input, instead of requiring authors to include it all. Authors would remain free to use the current syntax to manually build out their comboboxes if they require more customization.

Motivation and context
  • Fallback: these are native HTML elements so will work even without JS
  • Guaranteed accessibility: the JS can ensure proper roles and ARIA attributes are added to menus and trigger buttons
  • Intuitive markup: these are native HTML elements so the input name, option values, etc. are immediately clear to authors
Lenguaje dominante
JavaScript
Estrellas
175k
Forks
78.9k
Merge medio
4 d 2 h
PR fusionados (30 d)
89

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de twbs/bootstrap

Todos los issues de twbs/bootstrap

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.