As the title described, the modal should not remove the value while closing the modal: from the UX point of view, the user expects the X button will not delete his previous selection, but just dismiss the modal. I know there is a backButton, but even in this case, a modal (so a page that came from bottom to top) without navigation should not have a back arrow, because it assumes there is a page before and not behind it.
In fact, in the code you can find:
private _onClose(): void {
const { onClosed, onSelected, requireSelection, selected } = this.props;
const { modalVisible, selectedObject } = this.state;
if (requireSelection && (selectedObject && ![selectedObject.Id]) && (selected && ![selected.Id])) return;
if (!requireSelection) {
onSelected({} as IModalListInDto);
}
this.setState({
selectedObject: {} as IModalListInDto, // RESETTING
modalVisible: !modalVisible,
});
this.clearComponent();
if (onClosed) {
onClosed();
}
}
As you can see, the state will update with an empty object when the user closes the modal.
So, after that, the question is: is an architecture behavior to clear the selectedObject?
Otherwise, I can even make a PR to update this.
Hoping my point it's clear.
As the title described, the modal should not remove the value while closing the modal: from the UX point of view, the user expects the
Xbutton will not delete his previous selection, but just dismiss the modal. I know there is abackButton, but even in this case, a modal (so a page that came from bottom to top) without navigation should not have a back arrow, because it assumes there is a page before and not behind it.In fact, in the code you can find:
As you can see, the state will update with an empty object when the user closes the modal.
So, after that, the question is: is an architecture behavior to clear the
selectedObject?Otherwise, I can even make a PR to update this.
Hoping my point it's clear.