Bug fix - Inconsistent table border width size on zoom and extra spaces between table cells by ondrejkonec · Pull Request #1130 · StackExchange/Stacks
Problems:
- When zooming in/out, browser draw borders based on calculation (
1px* [zoom]). So for example1px * 150% = 1.5pxand sometimes there is1pxborder with and sometime2px. - Table is poorly designed using transparent backgrounds, which cause display problems.
Solution:
- Redesigned table (removed current pattern for displaying borders) and adding new solution
- Added 0.01px workaround, where browsers will fallback to at least
1px - Changed the border-width to the appropriate decimal per scaling level at the end of the file
- Removed opacity for disable table row, because it affects background color and also text => added text color and background color from Stacks color palette
Results:
Zoom 100%
All tables looks similar - There are only small things caused by the fact that I remove the transparent border.
Zoom 150%
Not sure why upload images here does not work, so please open each section in new window for compare.
Default table
Table with horizontal lines (s-table__bx)
Simple border (s-table__bx-simple)
No borders (s-table__b0)
Zebra striping (s-table__stripes)
Spacing - small (s-table__sm)
Spacing - Large (s-table__lg)
Sortable tables (s-table__sortable)
Bar graphs (s-table--progress-bar)
Bulk actions (s-table--bulk)
Total rows (s-table--totals)
Inactive rows (<tr class="is-disabled">)
Results
- All tables now looks consistent with 1px border across browsers, table variants and zoom levels
- There is no spacing between cells
Tested
- Tested on Chrome 106.0.5249.91, Safari 15.6.1, Firefox 105.0.1, Edge 105.0.1343.53
Note
I created all variations of Table component in Figma, if designers would like to use it in their component library.
What do you think?
Hope it helps!