Page MenuHomePhabricator

Reconsider the hiding of the first sidebar section title in Vector
Closed, InvalidPublic

Description

Result:
First sidebar section title is gobbled up and invisible

Expected Result:
When adding a menu/tree view to my wiki it was noticed that the title for that section is invisible if its the first section.
First sidebar section title should be visible right, if you want a particular title to be invisible this should be an option to that section.
Bug or possible enhancement if this is by design, I couldnt find any mention of if this was by intent.
The CSS for Vector style says something about IE8? skins/Vector/components/navigation.less

Reproduction

  1. Goto https://www.mediawiki.org/wiki/MediaWiki Using: Chrome and Firefox on Linux or Windows 10, generic install even seen on mediawiki.org
  2. Look at sidebar, notice the first section "Main Page..." is missing the portal-section-title
  3. On Chrome; right click on "Main Page" and select Inspect
  4. Look up a little in the HTML to see "<h3 id="p-navigation-label">Navigation</h3>", click on this
  5. See that the "Navigation" title has had its display value over-ridden due to "adjacent sibling" property div#mw-panel #p-logo + div.portal h3 { display: none; } h3 { display: block; <--- struck thru ....

Hacky Fix:
Add a separating <div></div> before any section using the hook for sidebar

// Place at end of your LocalSettings.php
$wgHooks['SkinBuildSidebar'][] = 'fnNewSidebarItem';
function fnNewSidebarItem( $skin, &$bar ) {  $bar = array( '' => "" ) + $bar; }

Alternative Fix:
Edit your skins/Vector/components/navigation.less and remove the "h3" section in the p-logo + div.portal section

/* First sidebar portlet. Not using :first-of-type for IE<=8 support. */
#p-logo + div.portal {
...
 h3 {  ... } 
...
}

Event Timeline

The feature is definitely intentional; the first section ("portlet") is treated specially. The design has evolved a bit over the years and it's less pronounced now, but it used to be also indented differently and it used to not be able to be collapsed (back when the menu sections were collapsible). The hidden heading is kept in page HTML for screen readers and text-only browsers.

Perhaps the implementation of this should be changed though. Maybe we could instead use the #p-navigation selector?

Note that the sidebar menu is defined in the 'sidebar' message (e.g. https://en.wikipedia.org/wiki/MediaWiki:Sidebar); this also defined the p-navigation ID. If we make the selector use this ID, we'll have to check Wikimedia wikis to see if any of them changed this ID and possibly modify their messages to use it. (This also offers an easier workaround: instead of using the 'SkinBuildSidebar' hook, just add another empty section at the beginning of the message.)

as suggested above removing "display: none"attribute result in displaying the "Navigation" heading I think this make a suitable fix?

Changed it in the following manner

mediawiki.png (768×1 px, 182 KB)

Change 407006 had a related patch set uploaded (by Rammanojpotla; owner: Rammanoj):
[mediawiki/skins/Vector@master] Fix sidebar initial section title adopt display:none

https://gerrit.wikimedia.org/r/407006

Change 407006 abandoned by Krinkle:
Fix sidebar initial section title adopt display:none

Reason:
The hiding of the first section title is not a bug. This is an intentional design decision. That's why the "display:none" rule exists.

I will tag T176538 with "Design" to ask them for feedback if they feel that this design should be revisited. If there is consensus to change the design to show this title, then this patch can be restored.

https://gerrit.wikimedia.org/r/407006

Krinkle renamed this task from Sidebar initial section-title incorrectly adopts display:none due to adjacent sibling CSS style to Reconsider the hiding of the first sidebar section title in Vector.Mar 12 2018, 11:39 PM
Krinkle edited projects, added Design; removed Patch-For-Review.
Krinkle moved this task from Needs triage to Design on the Vector (legacy skin) board.
Krinkle added a subscriber: Volker_E.
Jdlrobson subscribed.

It's not clear what the value of showing the heading would be. The heading is usable by screen readers but as Bartosz says this is intentional. Given I'm not sure why this is presented as a problem I am marking this as invalid. Feel free to reframe this as a new task outlining a problem that this causes rather than a possible solution.