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
mwc-radio does not properly group when used in lit-element map or repeat. #282
Labels
Type: Bug
Something isn't working
Comments
i fixed this issue like so /**
* Fixes Radio Buttens (can be removed in later versions)
*/
public updated()
{
var dialog = this.renderRoot.querySelector("mwc-dialog");
if (dialog == undefined) return;
var radios: any = dialog.querySelectorAll('mwc-radio');
const sControler = SelectionController.getController(<HTMLElement>dialog);
for (let index = 0; index < radios.length; index++)
{
const element = radios[ index ];
element._selectionController = sControler;
sControler.register(element);
}
console.log(this);
} |
aomarks
added a commit
that referenced
this issue
Oct 11, 2019
…aneously Selection groups are keyed by root (document or shadow root). Before, we created our selection group controller at construction. This is fine when creating and connecting at the same time (e.g. in HTML, or in a simple lit template), but fails otherwise, because we get the wrong root. Now we defer creating our controller until connectedCallback, so that we always get the correct root. Fixes #282 Supersedes #279 PiperOrigin-RevId: 274220064
polymer-github-robot
pushed a commit
that referenced
this issue
Oct 11, 2019
…aneously Selection groups are keyed by root (document or shadow root). Before, we created our selection group controller at construction. This is fine when creating and connecting at the same time (e.g. in HTML, or in a simple lit template), but fails otherwise, because we get the wrong root. Now we defer creating our controller until connectedCallback, so that we always get the correct root. Fixes #282 Supersedes #279 PiperOrigin-RevId: 274220064
polymer-github-robot
pushed a commit
that referenced
this issue
Oct 11, 2019
…aneously Selection groups are keyed by root (document or shadow root). Before, we created our selection group controller at construction. This is fine when creating and connecting at the same time (e.g. in HTML, or in a simple lit template), but fails otherwise, because we get the wrong root. Now we defer creating our controller until connectedCallback, so that we always get the correct root. Fixes #282 Supersedes #279 (Also small fix to mwc-textarea.test.ts to avoid use of any) PiperOrigin-RevId: 274220064
aomarks
added a commit
that referenced
this issue
Oct 11, 2019
…aneously Selection groups are keyed by root (document or shadow root). Before, we created our selection group controller at construction. This is fine when creating and connecting at the same time (e.g. in HTML, or in a simple lit template), but fails otherwise, because we get the wrong root. Now we defer creating our controller until connectedCallback, so that we always get the correct root. Fixes #282 Supersedes #279 (Also small fix to mwc-textarea.test.ts to avoid use of any) PiperOrigin-RevId: 274220064
polymer-github-robot
pushed a commit
that referenced
this issue
Oct 11, 2019
…aneously Selection groups are keyed by root (document or shadow root). Before, we created our selection group controller at construction. This is fine when creating and connecting at the same time (e.g. in HTML, or in a simple lit template), but fails otherwise, because we get the wrong root. Now we defer creating our controller until connectedCallback, so that we always get the correct root. Fixes #282 Supersedes #279 (Also small fix to mwc-textarea.test.ts to avoid use of any) PiperOrigin-RevId: 274220064
Just published version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The root node of a mwc-radio in a lit repeat/map is a document fragment with a text node, mwc-radio and text-node. This means each mwc-radio get its own unique selection controller, preventing the selection controller from working.
https://github.com/material-components/material-components-web-components/blob/8d2ab311e8cd24f2e82e91f89976e61d846098ad/packages/radio/src/selection-controller.ts#L41
A crude work-around is to override the _selectionController for each checkbox manually and call register, overriding the default improper behavior.
The text was updated successfully, but these errors were encountered: