This Question is Answered

1 "correct" answer available (5 pts) 15 "helpful" answers available (3 pts)
3 Replies Last post: May 9, 2008 12:22 PM by Kamal

Modal dialog wrt Browser Tabs

May 9, 2008 12:18 AM

Click to view URPradhan's profile BlackBelt URPradhan 167 posts since
Mar 6, 2008
Hi Friends

As we know modal dialogs do not permit us to access the other controls on page until they are closed.
Its perfectly OK for a single browser window.

But now-a-days we all are using browsers with multi-tab feature.
So, if in a tab (with Curl applet) there is an active modal dialog, then we are not able to access other tabs of the browser, means we are forced to close that modal dialog first.

But what I believe; that modal dialog should be related to that tab only, it should not happen that I can not access other tabs of my browser window as long as the modal dialog is active.
So, how can we relate modal dialogs wrt that tab ONLY which has hosted the dialog with out restricting us to access other tabs.

//Thank you

Click to view Kamal's profile Curl Kamal 149 posts since
Oct 17, 2007
1. Re: Modal dialog wrt Browser Tabs May 9, 2008 12:15 PM
Note that in case of Winodws and in Linux, each item in the Tab is in its own child Window (Mac is different as it does not have cross process child windows). To make a window modal you need to provide its owner. Child windows cannot be owners. So you have to move up the graphical hierarchy to find the top level window that contains the child window (and that happens to be your browser) and make it the owner. The way windows does the modality is to make the entire owner inactive. This means that the browser, in our case, will not get any pointer or keyboard events among other things. And hence you cannot tab between applets.

Here is a small experiment that you may try. When you have multiple tabs in your browser, try to bring a modal dialog say a File open dialog. Note that it will be modal to the browser.

The last time I checked, you will have a slightly different experience on Linux. On Linux modality is done in a different way. Curl implments it by making the AppletView (that represents the child window inside the browser) unresponsive and not the browser. So I think what you are asking for may actually be true in the Linux platform.

Message was edited by: Kamal

Click to view URPradhan's profile BlackBelt URPradhan 167 posts since
Mar 6, 2008
2. Re: Modal dialog wrt Browser Tabs May 9, 2008 12:09 PM
in response to: Kamal
Thank you Kamal.
Though I have not tried the Curl applet in Linux, but I have worked on UI projects on Linux/KDE/Qt.
In KDE, even though the dialog is modal you can access (move) the other UI controls but without any event :)
That means suppose my KDE/Qt application has a modal mesage/dialog still I can move/resize the parent of the modal dialog. But I cannot close that parent window.

So, in other words its depends upon the OS implementation.
But recently I have seen an Ajax based web application where they are using their custom modal dialogs which is modal to the particular browser tab ONLY !
Means while the modal dialog is active only that parent tab is IN-ACCESSIBLE, but other tabs were accessible with out any problem :D
So, surprised how they have implemented that ?
Click to view Kamal's profile Curl Kamal 149 posts since
Oct 17, 2007
3. Re: Modal dialog wrt Browser Tabs May 9, 2008 12:39 PM
in response to: URPradhan
No I am not surprised by that. On the Linux platform modality support depends on the choice of the Window managers so it is better if your application provides its own. Curl implements its own modal logic which is independent of the Window Manager. Also it does not need to make a Parent Window model and I do not think that it does. So as I said earlier, it will be what you are expecting.

Implementing this type of modality is not a rocket science. First you have to decide which events you want to filter out if a Window is an owner of a modal dialog. For example you will want to filter out the keyboard and pointer events, but you will not filter out the draw, resize, destroy, etc messages. So in case of multi tabs, your applet is a child window. If your child window brings up a modal dialog then just filter out the events for the child window when the modal dialog is up.

I will like to add that Tabs are a fairly new feature and though the browsers have adapted it they have still do not provided clean APIs to interact with them and I think that not a lot of effort was put behind issues like - which Tab is currently showing, how to make a dialog modal w.r.t. a Tab, etc. Curl could use its custom modality logic on Windows that it uses for Linux, but that will mean that a different user experience when using Curl on Windows.

Message was edited by: Kamal