I have overridden standard edit page with a lightning controller which will redirect to standard lightning record page or custom lightning component by different recordtypes.
The problem i am facing is when i press the standard Cancel button which appears on the modal, it just closes the modal, but it doesn't reditrect to record detail page.
To resolve this i checked for backgroundContext. This is working fine for New record page navigation, but for edit the backgroundContext is not working.
i am trying to make the page see like this
but currently the background is coming as blank.
JS
if (this.mode === 'edit') {
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
recordId: this.recordId,
objectApiName: 'XYZ__c',
actionName: 'edit'
},
state: {
nooverride: 1,
backgroundContext: '/lightning/r/XYZ__c/a2Q1j0000001nomEAA/view'
}
});
}