Open Bug 1450584 Opened 6 years ago Updated 6 months ago

Border of sticky or relative positionned table elements remains attached to main table when border-collapse:collapse is set.

Categories

(Core :: Layout: Tables, defect, P3)

59 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: fehop, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180323154952

Steps to reproduce:

- Applying `border-collapse: collapse` to a table and `position: relative` or `sticky` and a border to some of its components (e.g. the `<thead>`), in FF59.0.2 on Win10.
https://jsfiddle.net/_xlf/L71u84e0/2/

```css
table{
  border-collapse: collapse;
}
thead{
  position: sticky;
  top: 0px;
}
th{
  border: 1px solid black;
}
```

- Additionally applying a background to these elements.
https://jsfiddle.net/_xlf/kcd8ab5d/2/


Actual results:

- The border of the cells remains where it would have been without the extra positioning.
- Backgrounds are drawn over the borders, covering them up.

This might be because those positioned elements create a new layer in rendering, which the borders are not part of.

This also happens in Edge, btw. (Even though it does not support `position:sticky` on tables)


Expected results:

Border shold be part of the positioned element, like when `border-collapse: separate` is set. (see https://jsfiddle.net/_xlf/4m4x8shp/5/  and https://jsfiddle.net/_xlf/4290whhe/1/ , last one with background)
Component: Untriaged → Layout
Product: Firefox → Core
Component: Layout → Layout: Tables
the "new layer"-assumption is due to the backgrounds beeing rendered above.
also, maybe the term "display item" is more appropriate.
(idk, I'm new to this)
With border-collapse, I tend to think the borders *should* stay attached to the table.
(In reply to David Baron :dbaron: ⌚️UTC-7 (mostly unavailable April 2-20) from comment #2)
> With border-collapse, I tend to think the borders *should* stay attached to
> the table.

I get your point for the case if I was re-positioning just a single cell, however, here I'm making the whole `<thead>` sticky. There I'd still expect to have borders (like in office table calculation programs), especially as you need to have a background-color on the <thead> to ensure readability, which (now) in turn "erases" the borders.
I have created bug 1450601 for 1 isolated aspect of the tests in here.
Priority: -- → P3

Tables with a sticky header is very common, I'm surprised more people didn't complain about this. I'm impacted and would love to see that fixed.

Just found out this problem still exists. This is a five year old bug, how has that not been fixed yet?

I’m facing the same issue and it would be great to have it fixed. So far I implemented a work-around with border-collapse:separate but it creates more problems than it solves.
I also tested with Edge (Version 105.0.1343.53, 64-bit) and, if I remember well, the behavior was the same than with FireFox before as now the borders look to be transparent.

Severity: normal → S3
Duplicate of this bug: 1825541

So I tend to thing comment 2 is true, though chromium browsers seem to also paint the border of the sticky table cell, and I think that's a sensible thing to do given that creates its own stacking context...

Actually that's not right. Chrome is just doing something weird with the painting order, and I can't quite get what...

You need to log in before you can comment on or make changes to this bug.