-
Bug
-
Resolution: Fixed
-
Major
-
8.5.0, 8.5.1
-
None
-
Security Level: Jimmy
-
None
Steps to Reproduce
fiddle: http://zkfiddle.org/sample/12kc9do/2-ZK-popup-dom-location-fake-parent
- Click on do 1 button. This attach a popup to the page, and set it as context menu to the listitem.
- Right click on the listitem. This attach another popup to the page and set it as context menu to the tg button.
Current Result
The 2nd popup is attached as a child of the Listitem.
Expected Result
The 2nd popup should be attached as a child of the page
Debug Info
Following ZK-3606, popup.parent is changed to the anchor when a popup is opened on a widget, or with right click
Root Cause
https://github.com/zkoss/zk/blob/050d1b49d2dfe8e9896cc0a77de5e855e5c2e908/zul/src/archive/web/js/zul/Widget.js#L519
https://github.com/zkoss/zk/blob/050d1b49d2dfe8e9896cc0a77de5e855e5c2e908/zul/src/archive/web/js/zul/Widget.js#L545
https://github.com/zkoss/zk/blob/050d1b49d2dfe8e9896cc0a77de5e855e5c2e908/zul/src/archive/web/js/zul/Widget.js#L570
Workaround
<script><![CDATA[ zk.afterLoad('zul', function() { var xWidget = {}; zk.override(zul.Widget.prototype, xWidget ,{ doClick_: function (evt, popupOnly) { if (!this.shallIgnoreClick_(evt) && !evt.contextSelected) { var params = this._popup ? this._parsePopParams(this._popup, evt) : {}, popup = this._smartFellow(params.id); if (popup) { //popup.parent = this; // B85-ZK-3606: fake parent evt.contextSelected = true; // to avoid a focus in IE, we have to pop up it later. for example, zksandbox/#t5 var self = this, xy = params.x !== undefined ? [params.x, params.y] : [evt.pageX, evt.pageY]; // F70-ZK-2007: When type=toggle, close the popup if (params.type && params.type == 'toggle' && popup.isOpen()) { popup.close({sendOnOpen: true}); } else { setTimeout(function () { // F70-ZK-2007: Add the type and button number information popup.open(self, xy, params.position ? params.position : null, {sendOnOpen: true, type: params.type, which: 1}); }, 0); } evt.stop({dom: true}); } } if (popupOnly !== true) this.$supers('doClick_', arguments); },doRightClick_: function (evt) { if (!this.shallIgnoreClick_(evt) && !evt.contextSelected) { var params = this._context ? this._parsePopParams(this._context, evt) : {}, ctx = this._smartFellow(params.id); if (ctx) { evt.contextSelected = true; // to avoid a focus in IE, we have to pop up it later. for example, zksandbox/#t5 var self = this, xy = params.x !== undefined ? [params.x, params.y] : [evt.pageX, evt.pageY]; // F70-ZK-2007: When type=toggle, close the popup if (params.type && params.type == 'toggle' && ctx.isOpen()) { ctx.close({sendOnOpen: true}); } else { //ctx.parent = this; // B85-ZK-3606: fake parent //ctx._hasFakeParent = true; setTimeout(function () { // F70-ZK-2007: Add the type and button number information if (self.desktop) ctx.open(self, xy, params.position ? params.position : null, {sendOnOpen: true, type: params.type, which: 3}); //Bug #2870620 }, 0); } evt.stop({dom: true}); //prevent default context menu to appear } } this.$supers('doRightClick_', arguments); } });//zk.override });//zk.afterLoad ]]></script>
- relates to
-
ZK-3606 data-scrollable doesn't work on top page level components
- Closed