Fix Select to render native <select> by default (#91)#160
Open
oegedijk wants to merge 1 commit intoAnswerDotAI:mainfrom
Open
Fix Select to render native <select> by default (#91)#160oegedijk wants to merge 1 commit intoAnswerDotAI:mainfrom
oegedijk wants to merge 1 commit intoAnswerDotAI:mainfrom
Conversation
When searchable/insertable aren't requested, skip the <uk-select> web component and return a plain <select class="uk-select">. This makes id/name land on a real form control and lets HTMX attributes pass through unmodified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Fixes #91. +8 lines, one file.
Selectcurrently always wraps<uk-select>. That meansid/nameland on the wrapper, not a form control, so native form submission and HTMX (hx_trigger="change",hx_include="#my_select") don't work.Fix: when
searchable/insertablearen't requested, just returnfh.Select(..., cls='uk-select', id=id, name=name, **kwargs)and skip the web component.The searchable/insertable path is untouched.
Tradeoff
The closed/styled appearance is the same —
.uk-selectCSS styles native<select>too (border, padding, chevron, focus). The difference shows up when you open the dropdown: native uses the OS picker instead of the FrankenUI-themed panel. If a user wants the themed panel they opt in withsearchable=True.Rich HTML inside
<option>(e.g.Option(A(...))) won't render links in native — browsers only render text inside options. Nothing in the repo relies on this except the dashboard example where theAtags were cosmetic; the options still display fine.