Add selectedcontent button to select inputs#2061
Merged
Merged
Conversation
Insert a <button><selectedcontent></selectedcontent></button> as the first child of every native <select> (form input, select filter and per-page picker). This opts the selects into the customizable-select rendering already hinted at by the existing ::picker(select) utility classes, so the trigger mirrors the selected option's content while keeping the native control and its accessibility intact. Browsers without customizable-select support ignore the button and fall back to the standard <select>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a customizable-select trigger to every native
<select>in Backpex:inserted as the first child of each
<select>. Affected selects:Backpex.HTML.Form.input/1(type="select") — the shared select input used by theselectandbelongs_tofieldsBackpex.Filters.Select.render_form/1— the select filterBackpex.HTML.Resource.select_per_page/1— the "items per page" pickerWhy
Backpex already ships
::picker(select)utility classes (e.g. in the error styling of the select input), which only take effect underappearance: base-select. This change completes that direction: with the customizable-select rendering,<selectedcontent>mirrors the currently selected<option>'s content into the styleable trigger<button>, while the element stays a real native<select>— keyboard support, form submission and accessibility semantics are unchanged.Browsers without customizable-select support simply ignore the
<button>and fall back to the standard native<select>, so this is a progressive enhancement.Notes for review
multiple={@multiple}. The<button>/<selectedcontent>pattern is meaningful for single-select comboboxes only; formultipleselects it is inert. I added it unconditionally per the change's intent — happy to guard it with:if={!@multiple}if preferred.Verification (local)
mix compile --warnings-as-errors --force✅ (HEEx accepts<button>inside<select>)mix format --check-formatted✅mix test✅ 166 tests, 95 doctests, 0 failuresmix credo✅ no issuesmix docs --warnings-as-errors✅