Closed (duplicate)
Project:
Drupal core
Version:
11.x-dev
Component:
javascript
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
28 Sep 2009 at 17:49 UTC
Updated:
13 Apr 2024 at 05:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
liam morlandComment #3
liam morlandUpdated patch.
Comment #5
aspilicious commentedcurrent code
Means sticky_table class is set :)!
Fixed!
Comment #6
liam morlandThe point if this patch is to ensure that the new table containing the sticky header has the same class as the original table, minus sticky-enabled, plus sticky-table. This is needed because some modules create sticky-enabled tables with other classes assigned. Without this patch, the sticky header tables won't match up with their tables since they have different CSS rules applied to them. I have attached my patch rerolled against the latest D7.
Comment #8
aspilicious commented#6: tableheader-class.patch queued for re-testing.
Comment #9
liam morlandAttached is a version of this patch rolled against the latest Drupal 8.
Comment #10
liam morlandSame patch again, renamed so that it will get tested.
Comment #11
liam morlandUpdated patch rolled against latest D8.
Comment #12
liam morlandSorry, typo. Updated patch rolled against latest D8.
Comment #14
liam morland#11: tableheader-class.patch queued for re-testing.
Comment #15
liam morland#12: tableheader-class.patch queued for re-testing.
Comment #16
liam morlandUpdated patch rolled against latest D8.
Comment #17
liam morlandReroll.
Comment #18
kiphaas7 commentedThis looks fragile to me: suppose we're at a table with tabledrag enabled, or tableselect. They both add "-processed" classes, and both wouldn't be desired to be on the sticky table. let alone any contrib module.
Either we need a good whitelist (instead of blacklisting classes), or we need to pass the CSS classes set in php as a setting?
Comment #19
liam morlandDoes it hurt if the sticky header has these extra classes? The idea of this patch is to ensure that the sticky header has the same classes so that it is sure to be styled the same.
Comment #20
droplet commented@Kiphaas7,
can you explain more ? i don't get your meaning :)
@Liam,
No hurts I think and it should be.
Comment #21
droplet commentedComment #22
kiphaas7 commentedI can't remember what my actual problem was there, but I think I was complaining about the blacklisting (=removing) of _just_ the classes mentioned in
this.$stickyTable.removeClass('sticky-enabled tableheader-processed sticky-table');Contrib might do funky stuff to a table or table header as well, which might not be wanted on the sticky header. If the classes which are to be deleted are a javascript inline setting (passed in by php) contrib can overrule/extend it.
… Or contrib should write extra js to manually remove the class itself. However, that smells like a lot of event duplication in the javascript code. Basically I'd prefer if it was something like this
this.$stickyTable.removeClass(some.inline.setting.string.containing.all.the.classes);Comment #23
liam morlandIf I understand correctly, you would like modules to be able to add to the list of classes that are removed. That makes sense to me.
Comment #24
jhedstromComment #25
adci_contributor commentedRerolled
Comment #26
zaporylieBecause of missing `$` this patch doesn't work and gives errors in log console.
Should be:
I will fix #25 and provide a patch in next comment.
Comment #27
zaporylie...and here it is.
Comment #28
zaporylieThis is clean D8:
and this is D8 + patch #27:
I attached screenshots from chrome inspector as well.
Comment #29
wim leersComment #30
FreekyMage commentedReviewed, but changed so that the code is chained, which should give a small performance boost.
Comment #31
nod_Use addClass for consistency.
Also why do we do document.createElement now? we can just keep that and get rid of the addClass("sticky-header") line.
Comment #32
zaporylieHere's a patch and interdiff.
Comment #33
mglamanApplies, sticky table inherits same classes as main table.
Comment #34
kiphaas7 commentedAnd the comments in #18 - #23 are out of scope, or do these concerns no longer apply?
Comment #35
liam morlandI thought that would be neater and more clear, because it keeps all the class-related code together. As well, I suspect that it runs faster since jQuery no longer has to parse an HTML table tag with @class.
Comment #39
drintios commentedComment #40
drintios commentedDid reroll of patch #32 against 8.2.x
Comment #41
drintios commentedComment #43
liam morlandComment #45
xumepadismal commentedRe-rolled against 8.5.x
Comment #47
droplet commentedAdd a test and let it go.
Comment #48
GrandmaGlassesRopeMan- Reroll the patch from #45.
Comment #49
GrandmaGlassesRopeManComment #53
julia.klimovsky commentedReroll the patch on 8.6.x
Comment #54
julia.klimovsky commentedComment #56
avpadernoComment #59
berliner commentedPatch from #53 applies properly on 8.9.6 and works as advertised.
Comment #61
berliner commentedPatch updated to for 9.3.x-dev
Comment #62
berliner commentedLast patch had an indentation error. This one fixes it.
Comment #66
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #67
gauravvvv commentedPatch #62 contains changes to
tableheader.es6.jsfile. which is no longer part of 10.1.xRe-rolled patch for 10.1.x. Please review
Comment #68
smustgrave commentedThis seems like something that can have a test case to show the issue.
Comment #70
cslevy commentedI recreated the patch for Drupal 10.2.x
Comment #71
ajaypratapsingh commentedI rerolled the patch for Drupal 11.x
Comment #72
dipakmdhrm commentedI noticed that for a normal table, there's no duplicate sticky header. Header is made sticky using css.
But for a
tableselecttable, we have duplicate header.In this case too, ideally we should be able to make the header sticky using css.
Why do we have duplicate header? Is this remnant from some old issue or do we still need this?
Comment #73
dipakmdhrm commentedTo answer my own question, this was because IE11 didn't support `position: sticky`.
Now that Drupal >= 10 doesn't support IE11, we can use `position:sticky`.
It's already been done in https://www.drupal.org/project/drupal/issues/3362276 for some tables.
Let's do this for tableheader too.
Comment #74
dipakmdhrm commentedIssue to deprecate drupal.tableheader: https://www.drupal.org/project/drupal/issues/3439580
Comment #75
dipakmdhrm commentedClosing in favor of https://www.drupal.org/project/drupal/issues/3439580