-
Notifications
You must be signed in to change notification settings - Fork 77
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(calcite-radio-button): fixing issue where input isn't properly initialized in some cases #1011
Conversation
@@ -180,10 +180,6 @@ export class CalciteCheckbox { | |||
if (!scale.includes(this.scale)) this.scale = "m"; | |||
} | |||
|
|||
disconnectedCallback() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? Seems like the hidden input will get appended twice if the checkbox is removed and added back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this is intentional. When the component disconnects from the DOM, because the input is a child, it also gets destroyed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already discussed in Teams, but posting for posterity:
it also gets destroyed.
It shouldn't be. You can see this in the following example:
import { Component, Element, h } from "@stencil/core";
@Component({
tag: "calcite-example",
shadow: true
})
export class CalciteExample {
@Element()
el: HTMLCalciteExampleElement;
someEl: HTMLElement = null;
connectedCallback(): void {
this.someEl = document.createElement("div");
this.el.appendChild(this.someEl);
}
}
let example = document.createElement("calcite-example");
setInterval(() => {
document.body.append(example);
console.log("current element children", example.children.length);
example.remove();
}, 1000);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just had a concern regarding the cleanup of the checkbox's internal input. Once this is addressed, this is good to merge!
Related Issue: #977
I tested this on a local running instance of
arcgis-webviewer-app
without the workarounds that @kevindoshier was using as a temporary fix and I could not reproduce the bug, which consisted of unrendered input tags that correspond to each radio the second (and all subsequent) time(s) that the Map properties time slider options panel was opened.Kevin wasn't able to verify these fixes on his local copy, but despite that these fixes make sense to commit anyway because it makes radio and checkbox more consistent with how all other calcite components create input elements. We'll see once this makes it into a release and the webviewer can update calcite to see if this truly fixes the problem.