Page MenuHomePhabricator

Tables: 'mw-datatable' class
Closed, DuplicatePublic

Description

We have 'mw-datatable' class in MediaWiki core which was added on 2011. I think this code needs to be updated: colors, padding, etc.
https://phabricator.wikimedia.org/rMWf98a0ec075294df1bc7c9f70ca6a979137a26687

Something like that:

.mw-datatable {
	margin: 1em 0;
	border: 1px solid #a2a9b1;
	border-collapse: collapse;
	color: #000;
}
	
.mw-datatable > tr > th,
.mw-datatable > tr > td,
.mw-datatable > * > tr > th,
.mw-datatable > * > tr > td {
	border: 1px solid #a2a9b1;
	padding: 0.2em 0.4em;
}
	
.mw-datatable tr:hover td {
	background-color: #eaf3ff;
}

.mw-datatable > tr > th,
.mw-datatable > * > tr > th {
	background-color: #cfe3ff;
	text-align: center;
}
	
.mw-datatable > caption {
	font-weight: bold;
}

Tests

newone.jpg (360×634 px, 116 KB)

https://ru.wikipedia.org/wiki/User:Iniquity/test2

Event Timeline

As of right now, this seems to be already updated at https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki.legacy/shared.css#L354 (and that diff linked is old), am I missing something here? There's a few color differences from the one you suggested and the current one, so I suggest a screenshot of a datatable before and after + discussion.

resources/src/mediawiki.legacy/shared.css
/**
 * wikitable class for skinning normal tables
 * keep in sync with commonPrint.css
 */
table.wikitable {
	margin: 1em 0;
	background-color: #f8f9fa;
	border: 1px solid #a2a9b1;
	border-collapse: collapse;
	color: #000;
}

table.wikitable > tr > th,
table.wikitable > tr > td,
table.wikitable > * > tr > th,
table.wikitable > * > tr > td {
	border: 1px solid #a2a9b1;
	padding: 0.2em 0.4em;
}

table.wikitable > tr > th,
table.wikitable > * > tr > th {
	background-color: #eaecf0;
	text-align: center;
}

table.wikitable > caption {
	font-weight: bold;
}

Oh... Yeap, you are talking about wikitable, I am talking about mw-datatable.

Sorry that's my bad! wrong one. Here's the current version at https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki.legacy/shared.css#L476 below. Again, please make sure you provide screenshots since it's easier to visually understand what the differences are between yours and the current one.

Edit: Looks like you found it before me, heh :P

Iniquity updated the task description. (Show Details)

Even so, maybe, this class is used only for support, isnt it? For: wikitable+mw-datatable.