Links including #fragment to pages using tables with tableheader.js have their fragment position (relative page scroll offset) almost immediately reset to 0. Basically this stems from tableheader.js line 73, where it assumes that an invalid offset would return "undefined", wherein with jquery update, the offset returned no matter the existence of the element, will be a proper object, EG {top: 0, left: 0}.

The obvious answer here is to simply ensure the element exists before trying to set the page scroll offset! See patch in #1 for my first draft attempt at this.

As far as testing for this, simply try to link to any element with an ID on a page with sticky tableheaders, and if it's broken it will load correctly then snap to the top (in Firefox) and simply stay at the top (in Chrome).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

techninja’s picture

Here's the patch (one liner add to replace tableheader in the .module) and the tableheader.js for jquery_update/replace, which simply checks to see if the jQuery selector for the td it's looking for has a length before trying to adjust the page scroll (basically as it meant to in the original version of jQuery).

You will unfortunately have to diff against a stock D6 tableheader.js to see exactly what lines I changed. Diffs on non-existing files are tricky ;)

And for those playing at home curious about how to use git diff with new files, check out this awesome stackoverflow post!

toemaz’s picture

Issue summary: View changes

Thanks. Patch is working nicely!

markhalliwell’s picture

Status: Needs review » Closed (outdated)

Drupal 6 reached EOL (end-of-life) on February 24, 2016.