Page MenuHomePhabricator

Create basic sticky header feature flag
Closed, ResolvedPublic2 Estimated Story Points

Description

Background

This is the first task of the work for the sticky header. It will consist of creating the header bar and feature flagging it. Please review requirements for entire sticky header feature in T283505: [EPIC] Fixed "sticky" site header

Acceptance criteria

  • Set up a feature flag for the sticky header. It should be false by default.
  • When the feature flag is enabled, a class vector-sticky-header class should be added to the body tag.
  • Some CSS is applied to modern Vector to show the sticky header works (note this just verifies it's working, and doesn't reflect the end product or direction):
  • A query string param is available to override the feature flag
.vector-sticky-header header {
  position: sticky;
  top: 0;
  background: white;
}

developer notes

https://gist.github.com/jdlrobson/e795c574866e93299f5ace3c69590b4c

QA steps

Screen Shot 2021-08-04 at 1.24.53 PM.png (1×2 px, 545 KB)

  • Compare body tag without the query parameter

QA Results - Beta

ACStatusDetails
1T284463#7278978
2T284463#7278978

QA Results - Prod

ACStatusDetails
1T284463#7279002
2T284463#7279002

Event Timeline

ovasileva triaged this task as Medium priority.Jun 7 2021, 2:28 PM
ovasileva created this task.

How elaborate do we want the sticky header to be for this ticket? Do we want it to have all of the show/hide behavior that is in the prototype: https://people.wikimedia.org/~jdrewniak/dip/p4.html#/en/wiki/Moon ?

Some more questions that came out of a dev discussion:

  1. Do we want to build this as vanilla javascript or as a new Vue component?
  2. Can we leverage the existing header as the sticky header?
  3. Lazy loading strategies if we use Vue
  4. Source of data for the user menu, do we query the DOM for that?
  5. Do we want gadgets, like ones in the user menu, to remain in the sticky header menu?  
  6. How is the design different for anon users?
  7. Have we finalized triggers for sticky header, i.e. scrolling up. Are there any concerns with certain triggers, attempting to click a link near the top of the page. 
  8. How do we insert the search component into the sticky header? 

...

  1. Can we leverage the existing header as the sticky header?

Not sure how necessary/helpful this is, but just wanted to point out that the sticky header contains elements from the site header (search, user stuff), and the article header (talk, history, edit, language switching, article title):

image.png (357×1 px, 111 KB)

  1. Do we want gadgets, like ones in the user menu, to remain in the sticky header menu?

To begin with the sticky header will have a fixed set of elements. The only variability we've identified is in showing Edit and/or Edit source, which should possibly be dependent on user preferences and/or the configuration of the entire wiki

  1. How is the design different for anon users?

To begin with we will not be showing a sticky header to anon users

  1. Have we finalized triggers for sticky header, i.e. scrolling up. Are there any concerns with certain triggers, attempting to click a link near the top of the page. 

For now (and possibly indefinitely) the sticky header will always be visible once the person has scrolled past the page title — so that will be the only trigger for hiding and showing it. I've updated the prototype to be in sync with this (https://di-community-round-2.web.app/Romania). The prototype uses headroom.js to manage the visibility, but that's probably not necessary with our simplified approach to hiding & showing (I think intersection observer would be good and more simple).

In T284463#7206940, @alexhollender wrote:

...

  1. Can we leverage the existing header as the sticky header?

Not sure how necessary/helpful this is, but just wanted to point out that the sticky header contains elements from the site header (search, user stuff), and the article header (talk, history, edit, language switching, article title):

image.png (357×1 px, 111 KB)

  1. Do we want gadgets, like ones in the user menu, to remain in the sticky header menu?

To begin with the sticky header will have a fixed set of elements. The only variability we've identified is in showing Edit and/or Edit source, which should possibly be dependent on user preferences and/or the configuration of the entire wiki

+1 here. Noting that the user menu is within the sticky header and should include the gadgets that are included within the user menu at the top of the page

  1. How is the design different for anon users?

To begin with we will not be showing a sticky header to anon users

There will be a task for anon users as part of this epic. This task specifically will focus on the creation of the sticky header for logged-in users.

  1. Have we finalized triggers for sticky header, i.e. scrolling up. Are there any concerns with certain triggers, attempting to click a link near the top of the page. 

For now (and possibly indefinitely) the sticky header will always be visible once the person has scrolled past the page title — so that will be the only trigger for hiding and showing it. I've updated the prototype to be in sync with this (https://di-community-round-2.web.app/Romania). The prototype uses headroom.js to manage the visibility, but that's probably not necessary with our simplified approach to hiding & showing (I think intersection observer would be good and more simple).

Noting that we will do this for the first iteration only. Once we deploy on the pilot wikis, we might switch back to the triggered version of the header based on feedback.

Change 704870 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Update echo badges to use mw-ui-icon implementation in modern Vector

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

Change 704862 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/extensions/Echo@master] Add icon property to echo link data for modern Vector

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

ovasileva raised the priority of this task from Medium to High.Jul 28 2021, 2:41 PM
ovasileva renamed this task from Create basic sticky header and feature flag to Create basic sticky header feature flag.Aug 3 2021, 5:20 PM

Change 710079 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Add sticky header feature flag, query param, and class

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

Change 710079 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Add sticky header feature flag, query param, and class

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

cjming updated the task description. (Show Details)
cjming added a subscriber: bwang.

Status: ✅ PASS
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Navigate to a page on beta cluster with the query parameter &vectorstickyheader=1 i.e. https://en.wikipedia.beta.wmflabs.org/wiki/Albert_Einstein?vectorstickyheader=1
✅ AC1:Inspect the body tag in dev tools and note that the class skin-vector-sticky-header exists

<body class="ext-discussiontools-replytool-enabled ext-discussiontools-newtopictool-enabled mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Albert_Einstein rootpage-Albert_Einstein skin-vector action-view skin-vector-search-vue skin-vector-consolidated-user-links skin-vector-sticky-header">

Screen Shot 2021-08-12 at 7.34.21 AM.png (1×1 px, 409 KB)

✅ AC2: Compare body tag without the query parameter

<body class="ext-discussiontools-replytool-enabled ext-discussiontools-newtopictool-enabled mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Albert_Einstein rootpage-Albert_Einstein skin-vector action-view skin-vector-search-vue skin-vector-consolidated-user-links">

Screen Shot 2021-08-12 at 7.37.01 AM.png (1×1 px, 409 KB)

Edtadros subscribed.

Status: ✅ PASS
Environment: cawiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Navigate to a page on beta cluster with the query parameter &vectorstickyheader=1 i.e. https://en.wikipedia.beta.wmflabs.org/wiki/Albert_Einstein?vectorstickyheader=1
✅ AC1:Inspect the body tag in dev tools and note that the class skin-vector-sticky-header exists

<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Festival_Internacional_de_Cinema_de_Palm_Springs rootpage-Festival_Internacional_de_Cinema_de_Palm_Springs skin-vector action-view skin-vector-search-vue skin-vector-consolidated-user-links skin-vector-sticky-header">

Screen Shot 2021-08-12 at 7.43.09 AM.png (1×1 px, 478 KB)

✅ AC2: Compare body tag without the query parameter

<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Festival_Internacional_de_Cinema_de_Palm_Springs rootpage-Festival_Internacional_de_Cinema_de_Palm_Springs skin-vector action-view skin-vector-search-vue skin-vector-consolidated-user-links">

Screen Shot 2021-08-12 at 7.44.38 AM.png (1×1 px, 464 KB)

Looks great! Resolving.