Ticket #1875 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Calendar Picker javascript gets position wrong when scrolled in IE7

Reported by: nickmurdoch Assigned to: Chris Arndt
Priority: normal Milestone: 1.0.x bugfix
Component: TG Widgets Version: 1.0.4.4
Severity: normal Keywords: needs review
Cc:

Description

Hi all,

I've been writing out pages using Genshi's xhtml renderer, which I beleive is triggering a bug in the Calendar.js for IE, due to IE's broken document.body.scrollTop attribute. Googling seems to suggest using document.documentElement.scrollTop instead.

I'm not quite sure how to include diffs of a compacted JavaScript? file where everything's on one line, but the clause in question is

if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}

which starts on line 14, character 26081. Changing it to the following makes it work:

if(Calendar.is_ie){br.y+=document.documentElement.scrollTop;br.x+=document.documentElement.scrollLeft;}

This seems to be the problem if Genshi is outputting HTML or XHTML -- possibly a bug in IE if it's in standards-compliant mode?

Change History

06/26/08 10:29:27 changed by nickmurdoch

(Forgot to mention what the actual problem is -- the pop-up Calendar displays in the wrong place if the user is scrolled down, even off the top of the visible viewpane if they're scrolled down enough)

08/21/08 21:49:10 changed by Chris Arndt

@nickmurdoch: I don't quite understand you explanation of the symptom. Can you provide a screenshot, maybe?

Can somebody on Windows with an IE7 confirm that the suggested fix works?

08/22/08 08:23:54 changed by nickmurdoch

Hi Chris,

http://zoidberg.nevira.net/~flexo/stuff/calendarwidgetbug.png is a screenshot I took of the website in question -- sorry it's mostly blurred out; it's a customer's site. In the screenshot, I'd clicked the bottom-most 'Choose' button on the page.

If I scroll down further and click 'Choose' again, the calendar widget appears progressively further up the page until it disappears off the top.

I'm using genshi as the rendering engine, with genshi.default_doctype left commented out in the config file. The header generated for the page is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

...

The content-type served is: "Content-Type: text/html; charset=utf-8"

08/30/08 07:51:26 changed by Chris Arndt

  • keywords set to needs review.
  • owner changed from anonymous to Chris Arndt.
  • status changed from new to assigned.

Thanks, Nick, for the screenshot. I now see what the problem is. Unfortunately, I don't have a Windows machine with IE7 to test this at the moment.

If a second person can confirm that the attached fix works and doesn't break other IE versions, I'll gladly apply the patch.

08/31/08 08:45:34 changed by chrisz

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

I could reproduce this with MSIE7 and the widget browser where the position was so far off that it did not even show. The patch works and is also mentioned here, so applied it in r5322.