Jump to content

Template talk:Row hover highlight

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Note: Template:Mw-datatable/styles.css was moved (without redirect) to Template:Row hover highlight/styles.css on June 18, 2022.

mw-datatable class had white background for data cells

[edit]

Guarapiranga. Please have a look at: T284802. I started that task back when mw-datatable was still working. I wrote:

"class=mw-datatable (usually combined with class=wikitable) is used more and more. It produces a white background color that is preferred by many for statistic tables. Due to the better contrast and readability for many people. Versus the light gray background color of class=wikitable used alone. Plus class=mw-datatable will highlight the row that the cursor hovers over. Making it easier to scan across that row, especially if it is a long row."

Template:Import-blanktable/styles.css duplicated what mw-datatable did when it was working.

See examples: Help:Table#tpl-blanktable – row highlighting via cursor hover. White background

Can you add the white background too? --Timeshifter (talk) 13:35, 8 June 2022 (UTC)[reply]

Guarapiranga. Please try this out. It's what people expect from class=mw-datatable.
Comparing the CSS:
Template:Row hover highlight/styles.css
.hover-highlight tr:hover td,
.mw-datatable tr:hover td {background-color: #eaf3ff}
Template:Import-blanktable/styles.css
.tpl-blanktable {
    background: #fff;
}
.tpl-blanktable tr:hover {
    background: #eaf3ff;
}

So the combination would be?:

.hover-highlight tr:hover td,
.mw-datatable {background: #fff;}
.mw-datatable tr:hover td {background-color: #eaf3ff}
--Timeshifter (talk) 04:42, 13 June 2022 (UTC)[reply]
Timeshifter, I followed Jdlrobson's suggestion at T287997 upon Izno's recommendation that it should solely add the hover over effect rather than make any other modifications to the relevant CSS. If you want to see a specific css, you know you can add it to your common.css or skin.css, right? For more than that, you need consensus (which you clearly don't have). Guarapiranga  00:39, 19 June 2022 (UTC)[reply]
Jdlrobson gave some CSS that would work for hover. He did not say he was against the white background. And he did not follow Izno's comment. Izno's comment was later in the task thread. And Izno was talking about what should be incorporated into global or common CSS, not a template.
Krinkle agreed with me, and quoted me, and created a template that incorporated both the hover and the white background. See: Krinkle comment
Several others in T287997 supported keeping mw-datatable in global CSS as is, and that was with both hover and white background. For example, see Eric0892 comment.
In global CSS it was liked and used many times in other language wikis too. XanonymusX comment. And Base comment.
I see a simpler solution, Guarapiranga.
{{mw-datatable}} should redirect instead to Krinkle's template, Template:Import-blanktable. See redirect page:
https://wiki.riteme.site/w/index.php?title=Template:Mw-datatable&redirect=no
As discussed in T287997 Krinkle worked on mw-datatable in 2011. He created the template to duplicate it after mw-datatable no longer worked correctly in global CSS.
Also, this way we avoid duplication with your template here that currently only does hover highlighting.
Of course some additional mw-datatable CSS would have to be added to Template:Import-blanktable to allow it to work on all the many old pages using class=mw-datatable that now have {{mw-datatable}} added above the table wikitext by you and others.
--Timeshifter (talk) 04:13, 19 June 2022 (UTC)[reply]

Guarapiranga. What is the normal naming system for CSS template sandboxes? I don't have a lot of time, but I can try to test this.

It's been a long time since I did CSS sandbox tests for templates. If ever. I don't remember. And I probably used incorrect naming.

Is there a forum just for template help? --Timeshifter (talk) 02:24, 16 June 2022 (UTC)[reply]

WP:RT Guarapiranga  00:40, 19 June 2022 (UTC)[reply]

Merge discussion

[edit]

See: Wikipedia:Templates for discussion/Log/2022 June 19#Template:Import-blanktable. --Timeshifter (talk) 22:54, 19 June 2022 (UTC)[reply]

White background added per merge discussion close

[edit]

Per the merge discussion closing here:

"The result of the discussion was merge to Template:Row hover highlight."

.mw-datatable {background: #fff;}

Added here: Template:Row hover highlight/styles.css

See diff. You can see it right away by saving the page with the table. Even a save without making any changes. This will not show up in the edit history.

I am talking about tables that are using {{mw-datatable}} just above the table, and class=mw-datatable within the table.

I did some more tests here: User:Timeshifter/Sandbox177. I don't see any problems with background colors set for rows, or individual cells. See sections titled: "With Template:mw-datatable and class=mw-datatable"

I am going to wait before adding the CSS for this to have a white background:

{{row hover highlight}}
{| class="wikitable hover-highlight"
|+ Caption text
|-
! Header text !! Header text !! Header text
|-
| Example || Example || Example
|-
| Example || Example || Example
|-
| Example || Example || Example
|}
Caption text
Header text Header text Header text
Example Example Example
Example Example Example
Example Example Example

Do I just add this?

.hover-highlight {background: #fff;}

Like this?

.hover-highlight tr:hover td,
.hover-highlight {background: #fff;}
.mw-datatable tr:hover td {background-color: #eaf3ff}
.mw-datatable {background: #fff;}

Krinkle's template seems to be doing this more simply (without td):

I compressed the format:

.tpl-blanktable {background: #fff;}
.tpl-blanktable tr:hover {background: #eaf3ff;}

--Timeshifter (talk) 20:13, 7 October 2022 (UTC)[reply]

Merging

[edit]

I was looking at the pending merger. Currently, we have three classes that add a highlight (#eaf3ff) upon hover, but they all do it slightly differently:

Summary of highlight classes
Name Template Adds functionality to header? Adds white background?
mw-datatable {{Row hover highlight}} No Yes
hover-highlight {{Row hover highlight}} No No
tpl-blanktable {{import-blanktable}} Yes Yes

The easiest way to merge the templates would be to support all three classes at Template:Row hover highlight/styles.css. However, I suspect that this merge has not been completed in the past 17 months because that is not the solution anyone wants. I propose we deprecate tpl-blanktable in favor of mw-datatable. The header is already distinguished from the rest of the table, so it does not need to be highlighted. HouseBlastertalk 23:43, 23 December 2023 (UTC)[reply]

HouseBlaster. The header row highlighting is for tables that don't use class=wikitable. Those headers are the same color as the data cells. So row highlighting of the headers would be useful in that case. The CSS for it could be merged into the CSS for {{Row hover highlight}}.
I believe there are bots that can substitute {{Row hover highlight}} for {{import-blanktable}}. They could also substitute mw-datatable for tpl-blanktable. The bots would have to make around 400 substitutions.--Timeshifter (talk) 00:44, 24 December 2023 (UTC)[reply]
For clarity, you are proposing we deprecate tpl-blanktable, but add the heading functionality to the other two classes? If so, I would support that proposed solution. HouseBlastertalk 01:51, 24 December 2023 (UTC)[reply]
Yes, that is what I propose. But the tpl-blanktable class would have to stay functional until all the class substitutions were done. We can say that it is deprecated now, so that people stop adding it to more tables.
We could just add the tpl-blanktable class to {{Row hover highlight}} CSS now.
Then we could redirect {{import-blanktable}} to {{Row hover highlight}}.
Then we could merge the header functionality to the other 2 classes. Then we could use the bots to substitute the mw-datatable class for tpl-blanktable. --Timeshifter (talk) 02:16, 24 December 2023 (UTC)[reply]
I don't think it would be worthwhile to include tpl-blanktable in {{row hover highlight}}. Right now, it is easy to tell which pages use tpl-blanktable (and thus which pages need to be fixed): it is just the pages which transclude {{import-blanktable}}. It would also make it easier to use tpl-blanktable, which is counterproductive.
I have gone ahead and added the header functionality. HouseBlastertalk 02:33, 24 December 2023 (UTC)[reply]
As long as the bots do both substitutions in the same day, then there will not be any serious disruption. But if the 2 substitutions are separated by days, weeks, months, then there is no row highlighting on the ~400 pages during that time.
I would rather nuke {{import-blanktable}} now by redirecting it. Of course that would mean having to add the tpl-blanktable class now too. But we don't have to tell anybody about it. While waiting for its substitution to occur. --Timeshifter (talk) 02:45, 24 December 2023 (UTC)[reply]
I think it would be easier if we changed both the template and the name of the class in the same edit. HouseBlastertalk 03:04, 24 December 2023 (UTC)[reply]

If we redirected the {{import-blanktable}} page, then its info would no longer exist. People wouldn't know about it or its class. So less use. I don't know what you mean about changing the class name. Are you talking about substitution by bot? --Timeshifter (talk) 03:10, 24 December 2023 (UTC)[reply]

I mean edits like this, which change {{import-blanktable}} to {{row hover highlight}} and tpl-blanktable to mw-datatable in the same edit. HouseBlastertalk 03:13, 24 December 2023 (UTC)[reply]
Around 400 times? How long will that take for you? I think there are bots that can do the separate substitutions automatically. Not sure. --Timeshifter (talk) 03:20, 24 December 2023 (UTC)[reply]
An hour and a bit? HouseBlastertalk 04:21, 24 December 2023 (UTC)[reply]

The redirect Template:Import-blanktable has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at Wikipedia:Redirects for discussion/Log/2024 March 14 § Template:Import-blanktable until a consensus is reached. HouseBlaster (talk · he/him) 16:09, 14 March 2024 (UTC)[reply]

Doesn't work when using sticky headers without wikitable class

[edit]

Conversation moved to Template talk:Sticky header#This template stops another from working without the wikitable class to avoid multiple conversations. Jroberson108 (talk) 13:05, 27 October 2024 (UTC)[reply]