Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken checked property in <mwc-radio> #373

Merged
merged 1 commit into from Aug 15, 2019
Merged

Conversation

aomarks
Copy link
Collaborator

@aomarks aomarks commented Aug 15, 2019

Previously, we didn't trigger the SelectionController (the class that synchronizes radio button groups separated by a shadow root) when the checked property was set, so the previously checked radio in a group was not unchecked when a new one was checked.

This was more complicated than just triggering it from the existing property @observer, because that gives us batched async changes (via the UpdatingElement updated callback), so we can't reconstruct the order of checked sets correctly. Replaces the observer with a setter that can handle this synchronously.

Previously, we didn't trigger the SelectionController (the class that
synchronizes radio button groups separated by a shadow root) when the
checked property was set, so the previously checked radio in a group was
not unchecked when a new one was checked.

This was more complicated than just triggering it from the existing
property @observer, because that gives us batched async changes (via the
UpdatingElement updated callback), so we can't reconstruct the order of
checked sets correctly. Replaces the observer with a setter that can
handle this synchronously.
Copy link
Collaborator

@dfreedm dfreedm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aomarks aomarks merged commit 40f5e43 into master Aug 15, 2019
this.formElement.checked = checked;
})
checked = false;
private _checked = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be protected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, private makes sense for now.

@aomarks aomarks deleted the radio-checked-bug branch August 15, 2019 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants