-
Notifications
You must be signed in to change notification settings - Fork 16
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
[date-picker] sync the input
element value and forge-date-picker
value when disconnected from the DOM
#821
Comments
hmm this will be a tricky one to solve for the following reasons:
We currently allow for the input value to sync to the date picker by patching the Hopefully that gives you a good idea of what's going on, and why it operates the way it does currently. If we could include the I'm not quite sure the best way to handle this quite yet, and it will likely be solved on its own in the future when we can move the inputs to the shadow DOM. Are you able to force the communication to go through the |
@DRiFTy17, yes, I have a workaround to force the value of the setValue(value, fromVM): void { //tslint:disable-line:require-private-modifier
$super.setValue.call(this, value, fromVM);
// when the <forge-date-picker> is disconnected/removed from the DOM (if leaving a folder tab that has a date picker, for example),
// the input value gets set correctly, but the value of the component does not get synced. This is a workaround to set the
// component value until https://github.com/tyler-technologies-oss/forge/issues/821 is resolved.
if (!this.getElement().isConnected) {
this.getElement().value = new Date(value);
}
}, Why was this not an issue with TCW? Other than that, everything you said made sense, Kieran, thanks for the information! |
@jm-boop The reason this worked in TCW was purely by accident actually. That version had a memory leak where it would never clean up the patch that it applied to the |
Describe the bug:
When the
forge-date-picker
is disconnected/removed from the DOM, updating the component value does not update the input value, and vice versa.To Reproduce:
Steps to reproduce the behavior:
forge-date-picker
anid
to query select (ex.id='foobar'
)Expected behavior:
I expect the component value and input value to always be in sync, regardless if the component is connected or disconnect from the DOM.
Screenshots:
Please complete the following information:
Additional context:
For consumers of Forge, this can be a serious issue if JavaScript is changing the value of the input on disconnected components.
For example, with folder tabs, some frameworks will remove/disconnect the components upon tab switching, followed by updating the value of the
input
. This ultimately leads to old values 'sticking' when the tab containing the date-picker is clicked back into.The text was updated successfully, but these errors were encountered: