fix(task-item): fix updating checked status #5953
Open
+1
−6
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.
Changes Overview
The code currently uses
setAttribute
/removeAttribute
to update the checked status of the checkbox, this is the incorrect method to use. Checkboxes have achecked
property that can be set.See https://aileenrae.co.uk/blog/programatically-check-uncheck-checkbox-javascript/
Implementation Approach
Switch to setting
checkbox.checked
propertyTesting Done
Manually in browser.
Verification Steps
Open a collaborative session with task item extension available.
In one window check/uncheck the box a few times, then in the other window do the same.
Notice that the update appears to no longer propagate, the checkbox state does not change in the other window.
It is actually changing the attribute on the document node correctly, which you can see if have styling applied such as this (on the task item):
With the fix, it works again!
Additional Notes
Checklist
Related Issues
I couldn't find an existing issue for it, which I thought was surprising, but maybe I didn't look well enough.