Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
javascript
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2013 at 20:27 UTC
Updated:
28 Aug 2023 at 16:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
travist commentedHere are the patches to fix this issue. Apparently the issue is also in 7.x, so marking this for both 6 and 7.
Comment #2
pverrier commentedWith the (D7) patch the sticky header reaches now the full width of my tables, this is really better.
The columns are well sized on Firefox, but alas not on IE, Safari PC, Chrome.
Comment #3
travist commentedAre you saying that with this patch the columns are still not sized appropriately on IE, Safari PC, and Chrome, or was that were the issue was BEFORE you applied this patch?
Comment #4
travist commentedAnd the patch for 6.x does apply... it is just because it is trying to apply it to 7.x branch since this issue queue was created for 7.x.
Comment #5
pverrier commentedAs you can see on the joined screenshots, though the patch improves the rendering, there are still problems with Chrome (or Safari PC).
These renderings are done on a test site using the default bartik theme, on which I modified the style.css :
This has been done to reproduce the error I've noticed on the website I'm working on, which uses a responsive, customized, theme, where sizes are often given using percents.
In conclusion, the (D7) patch works perfectly for Firefox and corrects huge sizing errors.
For IE, it's almost perfect (on the site I'm working on there are still little shifts of 1 or 2 pixels, but the total width is ok ; it may be due to the combination of other CSS instructions).
The worst is for Chrome or Safari (total width is also good).
Comment #6
travist commentedThis could be fixed to instead use
$that.outerWidth(true)which should include margins and padding in its calculation.Here is the 7.x patch with this change.
Comment #7
pverrier commentedSorry, it doesn't change anything.
Comment #8
parthipanramesh commentedComment #9
malcomio commentedThe patch in #2097081-6: Sticky headers are not calculating the column widths properly. works for us on a 7.24 site using a Zen sub-theme - still need to do full cross browser testing though.
Comment #10
csevb10 commentedWe have a custom theme built off of omega 4.x.
Applying this patch resolved column spacing issues in the following browsers on mac osx 10.9.3:
Comment #11
mfbThanks for this, resolved our issues as well.
Comment #12
flocondetoilePatch #6 solved issue on Drupal 7.34.
Works fine.
Comment #15
David_Rothstein commentedLooks like a testbot fluke.
Comment #17
candelas commentedPatch #6 solved issue on Drupal 7.34.
Works fine. Thanks @travist
Comment #18
David_Rothstein commentedTestbot fluke.
Comment #20
candelas commentedI hope it passes test soon because each time I update Drupal I have to apply it on each site...
Comment #22
David_Rothstein commentedI took a closer look at this and essentially the same code appears to be in Drupal 8 - so wouldn't the bug exist there too?
Comment #23
droplet commentedD8 using jQuery 2.x which is take care of box-sizing.
Comment #24
andrej galuf commentedConfirming #6 worked in 7.38, temporarily overwriting the file in theme until the problem is fixed in core.
Comment #25
vengador commentedConfirmed #6 worked for me too! Thanks @travist!
Comment #26
mfbDrupal 8 doesn't have this problem in my testing (it looks like the width calculation issue was fixed in jQuery 1.8) so I'm setting this back to 7.x-dev
Comment #28
digitalfrontiersmediaI think there may be some confusion over whether or not travist's patch works depending on how the theme is setting the box-sizing CSS property. I noticed while using the Shiny theme from Drupal Commerce Kickstart 2 that it didn't matter what version of jQuery or which of the above patches etc. were attempted--all proposed solutions had a misaligned sticky table header on my Permissions admin page.
I noticed that Shiny set the table.sticky-header th CSS for box-sizing to "initial". Adding a custom module allows you to introduce CSS that works across themes. Adding the following CSS with a custom module fixed the misaligned sticky headers for me in conjunction with patch #6 above (although it may have fixed it without the patch but I didn't check). I'm assuming this is because the calculations (even $that.outerWidth()) were being calculated wrong because the basis of the calculation was incorrect with the different box-sizing setting.
Unfortunately, if a theme overrides this setting I'm not sure there's a lot Core could do to foolproof it without starting to get stupidly complex or verbose.
Comment #29
ann b commentedThe patch fixed my view perfectly, but the /admin/content page sticky headers became misaligned. We use the Administration Views module, and the Seven theme for administration views. I reversed the patch and then checked to see how Administration Views got the sticky headers to work. It turns out box-sizing is set to content-box on the th elements. I don't know where this got set originally. So I added the following css for my view:
And then my view started working. My site uses an omega theme, and box-sizing is set to border-box by default.
Thanks @travist and @DigitalFrontiersMedia.
Comment #30
liam morlandComment #31
joseph.olstadIf you are ajax replacing the table
have a look at this patch and explanation (example):
#1764912-38: Fix regressions and further improve tableheader.js
Comment #32
hughworm commentedCame across this using seven as admin theme. #6 didn't work but replacing "width" with "min-width" did (plus I added "box-sizing: border-box" because it needed it and I couldn't think of a reason not to...)
See patch attached.
Comment #33
hughworm commentedBut there's still a problem: I use module filter to filter the list. After filtering the "normal" header widths change but the sticky ones don't. A workaround is to change the window size while sticky headers are showing. I suppose this is more a problem for module filter than sticky headers.
Comment #34
albertski commentedI verified that #32 fixes the issue. I tested the patch from #32 in Safari, IE11, Edge, Chrome, and Firefix and verified it fixes the issue.
Comment #35
poker10 commentedThanks for working on this. I tried to simulate the issue, but with no luck. On a clean D7 install using the Seven admin theme (and some random content generated by Devel module), the sticky header on the table on
admin/contentis aligned correctly even without the patch (tested on Firefox and Chrome).Can we get an update, if this is still an issue? If yes, please update the issue summary with steps to reproduce the issue. Automated tests does not help us here, so we need to manually reproduce and test this. Thanks!