Skip to content

Fix checkbox checkedness not updating when checked attribute is cleared - #610

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1785881767-checkbox-checked-clear
Open

Fix checkbox checkedness not updating when checked attribute is cleared#610
nicoburns wants to merge 1 commit into
mainfrom
devin/1785881767-checkbox-checked-clear

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Fixes DioxusLabs/dioxus#5282 (signal-driven checked on <input type="checkbox"> updates once then sticks).

Root cause: dioxus-native-dom translates a falsy checked value into DocumentMutator::clear_attribute, but clear_attribute only removed the attribute from element.attrs — it never updated the element's checkedness stored in SpecialElementData::CheckboxInput. So false -> true worked (via set_attributeset_input_checked_state), but true -> false left the checkbox visually checked.

Fix in clear_attribute:

// after removing the attr, before the `!had_attr` early return
if (tag, attr) == tag_and_attr!("input", "checked") {
    if let Some(checked) = element.checkbox_input_checked_mut() {
        *checked = false; // + mark mutations_occurred
    }
}

This runs even when the attribute wasn't present, since checkedness can also be set by a user click without the attribute ever existing.

Adds regression tests in tests/blitz-tests/tests/checkbox_checked.rs driving a checkbox via a Dioxus prop through true/false transitions (both failed before the fix).

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/9d81d7c5e6f24e0e92d3da00b4f798ab
Requested by: @nicoburns

WPT results

No changes in test results compared to main.

Generated by the WPT workflow.

@nicoburns nicoburns self-assigned this Aug 4, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native renderer not updating signal subscriber in checkbox "checked" property

1 participant