Enterprise-ng: CAP: All event handlers removed from <body> after close

Created on 5 May 2020  路  5Comments  路  Source: infor-design/enterprise-ng

Describe the bug
Due to the following code, all event handlers will be removed from <body> when a CAP is closed

if (this.jQueryElement) {
   this.jQueryElement.off();
}

https://github.com/infor-design/enterprise-ng/blob/cbfd53bec0600d1f1510e74056d18f933b03f8ea/projects/ids-enterprise-ng/src/lib/contextual-action-panel/soho-contextual-action-panel.ref.ts#L410

this.jQueryElement is body

This may cause a number of issues. In our case, it causes our homepage control to stop reacting on resize after closing a CAP. E.g. the page and widgets stop being responsive.

To Reproduce
Set a breakpoint on line above when running a CAP sample, see that element is body.

Expected behavior
Only remove event handlers that are used / attached on body for the CAP (seems to be close and open)

Version

  • ids-enterprise-ng: 7.0.3
[1] type

All 5 comments

This has been in there quite a while? Thinking we change this to just off the the namespaced events.

Yeah seems it's been there for six months. Prior to 7.0.3, we used 6.3.0 in which the issue wasn't present

These are the events being registered (not namespaced I think?):

this.jQueryElement.on('close', ((event: any, isCancelled: boolean) => { this.onClose(event, isCancelled); }));
this.jQueryElement.on('open', ((event: any) => { this.onOpen(event); }));

For a workaround on our end for now, do you think it's OK to simply "off" open and close, or should the registration + unregistration be namespaced somehow? E.g. open.contextualactionpanel

I think it should be namespaced.. Pushing a fix you test shortly

QA Passed
moving this ticket to Done. Thank you.
v4.28.0

Was this page helpful?
0 / 5 - 0 ratings