Page MenuHomePhabricator

Toggle-link label of collapsible elements should not be shown in Google's Featured Snippets
Closed, ResolvedPublicBUG REPORT

Description

When a collapsible Wikipedia table appears in Google's Featured Snippets, the word "hide" will be inaccurately concatenated at the beginning of the header for the last column.

Steps to Reproduce:

  1. Open Google Chrome and navigate to google.com
  2. Copy + Paste: list of longest-running scripted u.s. primetime television series into the Google Search bar and press Enter

Actual Results:

c2f9af22aabc508eb9ee52998caf0ee1.png (692×1 px, 57 KB)

Expected Results:

c2f9af22aabc508eb9ee52998caf0ee1-fixed.png (692×1 px, 67 KB)

Possible Solution?
Modify MediaWiki's Common.js to include Google's data-nosnippet attribute within a span around 'hide' in the resulting HTML document.

Event Timeline

Hi @JackWeather, thanks for taking the time to report this and welcome to Wikimedia Phabricator!

On-wiki content like user scripts, gadgets, templates, custom JS and CSS are local features and managed independently on each wiki by each community.
Phabricator is mostly used for MediaWiki, MediaWiki extensions, or server configuration, or by developers and teams to organize what they plan to work on.
Could you please bring this up on https://en.wikipedia.org/wiki/MediaWiki_talk:Common.js or https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical) ?
This needs fixing on the local wiki. I am closing this task here - thanks for your understanding!

@Aklapper I think this can be fixed from MediaWiki core and would be more efficient than leaving it for every install/wiki to manually fix. The attribute will need to be added only once where the togglelink/content is generated.

Ammarpad triaged this task as Low priority.

I will check this more

buildDefaultToggleLink = function () {
 return $( '<a>' )
        .addClass( 'mw-collapsible-text' )
	.text( collapseText )
	.wrap( '<span class="mw-collapsible-toggle mw-collapsible-toggle-default"></span>' )
	.parent()
	.attr( {
	    role: 'button',
	   tabindex: 0
	} );
};

I think the data-nosnippet attribute just need to be added to the span class that wraps the text:

...
  text( collapseText )
  .wrap( '<span class="mw-collapsible-toggle mw-collapsible-toggle-default data-nosnippet"></span>' )
...
Ammarpad renamed this task from "hide" inaccurately appears in Google's Featured Snippets to Toggle-link label of collapsible elements should not be shown in Google's Featured Snippets.Aug 5 2020, 6:55 AM

@Jdlrobson As suggested by Aklapper, I posted this to Wikipedia's Village Pump (technical), and some helpful users resolved the issue for that specific local wiki by simply removing the collapsibility of the table.

As for the issue in general - Izno contributed to the Village Pump post: "Generally, no tables should be collapsible in mainspace (see WP:MOSCOLLAPSE)"

As far as I see it, as long as Wiki posters follow the Manual of Style, this issue shouldn't be a problem and I have yet to encounter it again.

Jdlrobson claimed this task.