Clicking "Add comment to this bug" reloads the page then jumps to the top

Bug #6434 reported by Matthew Paul Thomas
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
James Henstridge

Bug Description

From https://launchpad.net/whatever/+bug/n, clicking "Add comment to this bug" expands the comment field, but then loads https://launchpad.net/whatever/+bug/n/+index#, which has a collapsed comment field. Clicking "Add comment to this bug" on *this* page expands the comment field, but then jumps to the top of the page, the opposite end of the page from the comment field.

I should never see any page with +index in the URL.

Tags: lp-bugs
Revision history for this message
James Henstridge (jamesh) wrote :

This affects Safari (so possibly also konquerer).

The new javascript generates an <a href="#"> element and attaches a click event handler. The end of the handler cancels the event (to prevent the link being followed) with this code:

    // cancel the default action of the event
    if (evt.preventDefault) {
        evt.preventDefault();
    } else {
        evt.returnValue = false;
    }

The first branch works with browsers supporting DOM 2 events. The second is fallback for internet explorer.

Changed in malone:
assignee: nobody → jamesh
status: New → Accepted
Revision history for this message
James Henstridge (jamesh) wrote : Hook up toggleCollapsible by assigning to "onclick"

Matthew: could you try the attached patch with Safari? This alternative version uses the traditional method of hooking up events, rather than the DOM 2 events API (or IE events API).

I've tested this patch with Firefox and IE6. If it works with Safari too, then I'll commit.

Revision history for this message
James Henstridge (jamesh) wrote :

Brad reports that the patch corrects the problem when using "Safari 2.0.2 (416.13)", so this updated code should work with the major browsers.

Changed in malone:
status: Confirmed → Fix Committed
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.