Ticket #6921 (closed defect: fixed)

Opened 6 months ago

Last modified 3 weeks ago

[patch] dojo.coords() problems on Safari and Opera

Reported by: elazutkin Owned by: haysmark
Priority: normal Milestone: 1.2
Component: HTML Version: 1.1.1
Severity: normal Keywords:
Cc:

Description

Tooltips look off when the page is scrolled on Safari and Opera (tested current versions + Opera 9.5b on Linux and Windows). Looking at the code I suspect that dojo.coords() is at fault.

I was able to reproduce the problem with dijit/tests/test_Tooltip.html. Scrolling the page it is easy to see that tooltips on some elements are off, yet other elements work as expected.

Attachments

abs_wip.patch (2.0 kB) - added by haysmark 5 months ago.
Possible fix for dojo._abs.
abs_wip.2.patch (4.4 kB) - added by haysmark 5 months ago.
Another fix to dojo._abs, for wide borders.
abs_wip.3.patch (1.7 kB) - added by haysmark 5 months ago.
Fix for Opera and FF2. All abs tests pass with this patch.

Change History

Changed 6 months ago by bill

Strange... I see the deviant behavior on links and buttons.

Changed 6 months ago by bill

  • owner changed from alex to bill
  • status changed from new to assigned
  • milestone set to 1.2

I'll fix. This is due to the checkin [12117] / #5295. ISTM safari flip-flopped it's behavior between 2.0 and 3.0 and then back again for 3.1 (or whenever it was that this problem started occurring).

Changed 6 months ago by bill

I spoke too soon. The difference between the elements that appear correctly or not is whether those elements are direct children of <body>, and sure enough dojo._abs() has if() statements branching on that condition (although perhaps they are doing more harm than good).

Changed 5 months ago by bill

(In [14223]) Supplementary tests for dojo._abs(). Unfortunately they seem to fail in one way or another on all browsers. This should be converted to a DOH automated test. Refs #6921.

Changed 5 months ago by haysmark

Possible fix for dojo._abs.

Changed 5 months ago by haysmark

Here is a diff that I have had better success with.

My experiences with the abs test comparing the nightly vs my patch:

IE: unchanged

FF2:

  • Nightly: Everything in at least one div was off (not adding computed margin/padding of parents?)
  • Patched: only click3 fails

FF3:

  • Nightly: Consistently placed red box in bottom-middle of button
  • Patched: clicks 3,7,8 appear just a tad too far inside the button

Safari 3.1.1:

  • Nightly: Very bottom button failed, very top button failed when you scrolled down a little
  • Patched: Everything works

Opera 9.27:

  • Nightly: Everything fails
  • Patched: 3,5,7,8 fail when you scroll their parent divs down; scrolling the document has no effect.

Changed 5 months ago by bill

Thanks Mark, this looks great. I ran the tests also, got the same results as you. I will check in but leave the ticket open for the remaining issues.

Changed 5 months ago by bill

Above patch checked in as [14326].

Changed 5 months ago by haysmark

Another fix to dojo._abs, for wide borders.

Changed 5 months ago by haysmark

Here is a new patch for dojo._abs.

I tried test_BorderContainer and noticed that my first patch broke in FF2 and FF3. FF3 was actually better off with the IE code but still needed a fix for the strange offset. The reason FF3 was offset was because you needed to add the margin of the document element. So now everything is much better in FF3 since I fixed the IE path with a FF3 conditional.

Even in Dojo 1.1 FF2 abs was just horribly broken and it became very obvious after I added 17px borders to the abs test and ran it against 1.1. My first patch only appeared to work because the abs test had thin borders. The padding/margin weren't the problem: the borders were.

With this new patch, FF2 passes the bordered abs test and is working for BorderContainer? again. click3 is still broken and now it is very obvious just how much so with the added borders. It looks like that because click3 is static AND is in a static div that has a border, click3 is being offset by the border. The code skips over this div since the div is not in the offsetParent chain. Hmm.

Safari and IE are unchanged with the addition of borders to the abs test and still pass. Opera still has the problems I mentioned earlier.

Changed 5 months ago by toonetown

With this most recent patch, I can verify that click3 is broken on FF2.

Click3, click5, click7, and click8 are still broken in Opera (9.51). However, since it's still better and fixes the FF3 issues as well, I'll check it in (but still leave open).

Changed 5 months ago by toonetown

(In [14339]) Refs #6921 - updated patch by haysmark to fix FF3 and FF2 issues. See ticket for details !strict

Changed 5 months ago by bill

  • owner changed from bill to haysmark
  • status changed from assigned to new

I guess we are leaving this open until every single test works.

Changed 5 months ago by haysmark

Fix for Opera and FF2. All abs tests pass with this patch.

Changed 5 months ago by haysmark

  • status changed from new to assigned
  • summary changed from dojo.coords() problems on Safari and Opera to [patch] dojo.coords() problems on Safari and Opera

Here is another patch for dojo._abs.

I added a new code path for Opera regarding the scrolling. Apparently position:absolute has some interesting effects on how Opera calculates scrollLeft/Top. Now all buttons in dojo/tests/abs.html work for Opera.

Also, my suspicions about FF2 static elements seem to be correct. click3 now works in FF2, so now all buttons work for FF2.

Changed 5 months ago by bill

  • status changed from assigned to closed
  • resolution set to fixed

(In [14470]) Further patches to dojo._abs() for opera and FF2. Fixes #6921 !strict Patch from Mark Hays (IBM, CCLA on file). Thanks!

Changed 3 weeks ago by bill

See also [15730] and [15731] for further changes.

Note: See TracTickets for help on using tickets.