Ticket #1875 (closed defect: fixed)
Calendar Picker javascript gets position wrong when scrolled in IE7
| Reported by: | nickmurdoch | Owned by: | 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
comment:2 Changed 3 years ago 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?
comment:3 Changed 3 years ago 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"
comment:4 Changed 3 years ago by Chris Arndt
- Owner changed from anonymous to Chris Arndt
- Status changed from new to assigned
- Keywords needs review added
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.
(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)