Project

General

Profile

Actions

Bug #6379

closed

WDialog is sometimes created behind an existing one

Added by Ján Dugáček over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Roel Standaert
Target version:
Start date:
05/21/2018
Due date:
% Done:

0%

Estimated time:

Description

Widgets of class WDialog are usually created in front of existing dialogs as expected, but sometimes, it fails and the new dialog is open behind an existing one.

The way to replicate it seems to be: open an asynchronous dialog (d1), then click on a button that opens another asynchronous dialog (d2). In the d2 dialog, click on a button that closes it and destroys it. Then on the d1 dialog, click on the button that opens the d2 dialog again. The d2 dialog will appear behind d1.

It might not be the only way to replicate it. The problem can be partially avoided fixed by calling the d2 dialog's raiseToFront() method whenever it's created, but it doesn't seem to work on all browsers.


Files

issue_6379.cpp (1 KB) issue_6379.cpp Roel Standaert, 05/24/2018 04:05 PM
Actions #1

Updated by Roel Standaert over 6 years ago

I tried to reproduce this with the latest master, but it appears to be working properly. Maybe I didn't completely understand your issue. I attached the test I used.

Actions #2

Updated by Ján Dugáček over 6 years ago

I can replicate it on the latest version. However, I found that I have missed out one crucial step in the replication process. Writing it again:

  • open an asynchronous parentless dialog (d1)
  • move d1 so that the a newly opened dialog would partially overlap it, but its clickable contents would not be obstructed
  • click on a button that opens another asynchronous parentless dialog (d2)
  • (added) click on an empty place on d1 to make it raise to above d2
  • in the d2 dialog, click on a button that closes it and destroys it
  • in the d1 dialog, click on the button that opens the d2 dialog again
  • d2 dialog will appear behind d1
Actions #3

Updated by Saif Rehman over 6 years ago

Is this related to my issue: https://redmine.emweb.be/issues/6219 ?

Actions #4

Updated by Ján Dugáček over 6 years ago

Probably.

Actions #5

Updated by Ján Dugáček over 6 years ago

So I have created a test case where it can be replicated. It's at: https://pastebin.com/Mu0YmtuV

The progression is as I described, open one dialog, move it slightly to the left, open another dialog, click on the first dialog, close the other dialog, open a new dialog and the dialog will appear behind the first one.

Actions #6

Updated by Roel Standaert about 6 years ago

  • Target version changed from 4.0.4 to 4.0.5
Actions #7

Updated by Roel Standaert about 6 years ago

  • Status changed from Feedback to InProgress
  • Assignee set to Roel Standaert

I see what's happening here:

  • A new dialog (A) is created and given z-index 0 + 100 = 100
  • Another dialog (B) is created, given z-index 100 + 100 = 200 (new dialogs get a higher z-index)
  • Dialog A is brought to front, the associated JavaScript code adds 1 to the highest z-index of the other popups, yielding z-index = max(100, 200) + 1 = 201, however the server is unaware of this new z-index
  • Dialog B is closed
  • A new dialog © is created and given z-index 100 + 100 = 200, because as far as the server is concerned, the z-index of dialog A is still 100 (while it is actually 201)
  • Result: dialog C is shown under dialog A instead of on top of it

So now I'll have to see what the best way would be to fix this...

Actions #8

Updated by Roel Standaert about 6 years ago

  • Status changed from InProgress to Resolved
Actions #9

Updated by Roel Standaert almost 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF