AnswerDotAI / AnswerDotAI/MonsterUI
monsterui Select not working when a switch or checkbox is present
- Dominant language
- Jupyter Notebook
- Stars
- 522
- Forks
- 33
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Sorry to bother you again :) The mui.Select and fh.Select are still not equivalent when there is e.g. a switch or a checkbox present, the Select value is not passed with mui.Select but it is passed with fh.Select:
```python
import monsterui.all as mui
from fasthtml.common import *
# app, rt = fast_app()
hdrs = mui.Theme.blue.headers()
app, rt = fast_app(hdrs=hdrs)
@rt("/")
def get_index():
return Div(
Form(
CheckboxX(
checked=True,
label="Toggle",
id="toggle",
name="toggle",
hx_get="/example",
hx_target="#example-content",
hx_swap="innerHTML",
hx_include="#example_selector",
),
mui.Select( # this does not work
# Select( # this works
Option("Option 1", value="1"),
Option("Option 2", value="2"),
Option("Option 3", value="3"),
id="example_selector",
hx_get="/example",
hx_target="#example-content",
hx_trigger="change",
hx_swap="innerHTML",
hx_include="#toggle",
name="example_id",
),
id="example-form",
),
Div(id="example-content"),
)
@rt("/example", methods=["GET"])
def get_example(example_id: str = "not selected", toggle: bool = False):
return Div(
f"Example content for option {example_id} and {toggle}",
)
serve()
```
result with fh.Select:
result with mui.Select:
Contributor guide
Research direction
Start by running the Python reproduction in the issue and compare the request produced by mui.Select with the one produced by fh.Select when the checkbox is included. Trace the Select rendering and form submission behavior, then verify that the selected example_id is received alongside toggle as shown in the expected fh.Select result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100