You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works when opening the modal is not tied to a state change, however, if for example the modal opens upon turning on a toggle switch, if the user does not submit the modal then we need to rollback the toggle state to off.
Currently the close event emits both if the user cancels/closes or submits, so we cannot distinguish between the two cases within the onClose handler without adding additional tracking in the client component.
Can we separate these cases into three events?
close - always emits (already exists)
cancel - emits if modal is closed without submitting (new)
submit - emits if modal is submitted (already exists)
This will allow us to place any state cleanup code in the onCancel without needing to track the modal's internal state.
2-
Related to the above, there is currently no way no programmatically set the value of a sam-toggle-switch, but we may need to undo a toggle if it is conditional on additional steps like a modal. Can we add a method like setToggleValue?
The text was updated successfully, but these errors were encountered:
@kevin-song-reisys@colinalford-gsa for the second item, because the component implements the control value accessor interface you should be able to set it via ngModel in template driven forms or the reactive way via setValue() or patchValue()
@diego-ruiz Good point, I forgot about that interface. I did try directly setting isSwitchOn value though, and I think it did update the value but did not trigger any events. Maybe we can add the same event emits/any other logic to the writeValue()?
1-
Currently the modal component calls
closeModal()
when the cancel button is clicked (https://github.com/GSA/sam-ui-elements/blob/master/src/ui-kit/components/modal/modal.template.html#L21), and emits the corresponding event.This works when opening the modal is not tied to a state change, however, if for example the modal opens upon turning on a toggle switch, if the user does not submit the modal then we need to rollback the toggle state to off.
Currently the close event emits both if the user cancels/closes or submits, so we cannot distinguish between the two cases within the
onClose
handler without adding additional tracking in the client component.Can we separate these cases into three events?
close - always emits (already exists)
cancel - emits if modal is closed without submitting (new)
submit - emits if modal is submitted (already exists)
This will allow us to place any state cleanup code in the
onCancel
without needing to track the modal's internal state.2-
Related to the above, there is currently no way no programmatically set the value of a
sam-toggle-switch
, but we may need to undo a toggle if it is conditional on additional steps like a modal. Can we add a method likesetToggleValue
?The text was updated successfully, but these errors were encountered: