Friday, June 12, 2015

Pausing or canceling native preview event handling ?

Please some tips/advice on the following situation (gwt version: 2.7.0):

I have a site with a Member Subscribe popup that is automatically hidden when you click (tap) outside the popup, that I realized through a NativePreviewHandler. That works well.
However, the popup has a link that opens a modal (glassPanel) popup that blocks any interaction with the app apart from the new popup itself. But when I then click somewhere the Subscribe popup behind the modal popup is hidden because of the preview event handling, which is undesired.
How to solve this?
The modal popup also uses a NativePreviewHandler to block any interaction with the display apart from the modal popup.

The solution I can think of:
Cancel/prevent the preview event being processed by the Subscribe popup when the modal popup is open.
But how?:
1) It's hard to inform the subscribe popup when modal popup is opened and closed, the are independent and get's dirty to link them together. Besides that, most code is generated from xml files through html5 data-* fields.

2) The modal popup adds his own NativePreviewHandler and will block/cancel any further Native preview event handling, such that the subscribe popup isn't informed. This could be possible as the NativePreviewHandler instances are fired in reversed order. 
But the NativePreviewHandler event has not such thing as a cancel option :(... I looked at overriding the gwt code, but that also gets dirty. 
I could create my own PreviewEvent that contains all NativePreviewHandlers, and has one NativePreviewHandler registered to the GWT event class. We then have control of enabling/disabling handlers....

3) Not use a NativePreviewHandler in the subscribe popup, but a normal "Handler" on the body element that informed about clicks/taps/mouse-up/etc.. 
This handler can be canceled by the NativePreviewHandlers in case they indicate the event isn't allowed to be "normally" processed.

I don't like the solutions soo much and was wondering if anybody has some advice/ideas/solution that I don't see? 
Please shout ;)

Btw, you can the situation in action on leuker.nl: click "login" in the top menu, then click on "account aanmaken" and click on "pricacy voorwaarden" to show the modal popup.



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment