Skip to content

Commit

Permalink
Page feedback tool: Revamp
Browse files Browse the repository at this point in the history
General:
* Rename "page success widget" to "page feedback tool"
* Turn it into a site component

Jekyll:
* Change the tool into an include
* Use sub-includes for parameter/string variable declarations
* Add a pageFeedback variable to enable the tool in page templates
* Add pageFeedback sub-variables to optionally override the default values of the tool's form parameters:
  * institutionopt
  * themeopt
  * sectionopt
  * pageTitle (true re-uses the current page's title, without " - Canada.ca")
  * language (true re-uses the current page's language)
  * submissionPage (true re-uses the current page's URL)
* Update the page details footer include to accommodate the tool:
  * Declare col-modified = "col-xs-12" only once at the beginning of variable assignments
  * Support pageFeedback and prioritize it over report a problem
  * Make pageFeedback take priority over noReportProblem (i.e. setting former to true and latter to false will show the page feedback tool)

SCSS:
* Add new classes (tied to the gc-pft class):
  * nojs-col-sm-12
  * nojs-pr-sm-0
  * nojs-text-left
* Increase the share widget's top margin to make it look vertically-centered when used alongside the tool in small/medium view and over
  * Depends on the has() pseudo-class

HTML:
* Rename the gc-pg-hlpfl id/class prefix to gc-pft
* Rename the gc-pg-hlpfl-btn class to gc-pft-btns ("s" suffix)
* Use a fieldset for "Did you find what you were looking for?" and its yes/no buttons
* Change "Did you find what you were looking for?" into a legend
* Improve layout:
  * Remove heading classes
  * Use form classes (i.e. chkbxrdio-grp, field-name and form-group)
  * Increase spacing between groups of content
  * Move the details field's secondary information paragraph below the field
  * JS mode:
    * Center-align "Did you find what you were looking for?" in extra-small view
    * Vertically-center "Did you find what you were looking for?" and yes/no buttons in small view and over
  * Noscript/Basic HTML mode:
    * Position the yes button directly below "Did you find what you were looking for?" in all views
* Use aria-live regions to announce transition messages to screen reader users:
  * "Tell us why below:" upon pressing the no button
  * "Thank you for your feedback." upon pressing the yes button or submitting the no button's questionnaire
* Add aria-describedby attributes to:
  * Programmatically-associate the yes button to the "If not, tell us why below:" paragraph in noscript/basic HTML mode (to make screen readers announce the no button's instructions right after the yes button)
  * Programmatically-associate the secondary information paragraph to the more details field

Content:
* Add a visually-hidden "Page feedback" H3 heading
* Add a period to the end of "Thank you for your feedback"
* Add "below" to the end of "If not, tell us why:" in noscript/basic HTML mode
* Add a visually-hidden "Tell us why below:" paragraph in JS mode
* Combine "Please provide more details" and "Maximum 300 characters" into the same label
* Write all values in an "EN-FR" format, derived from labels

Demo pages:
* Add a standard demo page (pageFeedback enabled)
* Add a custom demo page (pageFeedback with sub-variables)

Provisional functionality page:
* Portray the widget as stable in the feature availability table
* Remove "page success widget" section/example

Co-authored-by: David Elisma <[email protected]>
  • Loading branch information
2 people authored and Garneauma committed Feb 8, 2023
1 parent 8e3a4f0 commit 07ae8b3
Show file tree
Hide file tree
Showing 22 changed files with 671 additions and 179 deletions.
44 changes: 44 additions & 0 deletions _data/sites.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,50 @@
]
}
}
,{
"@context": {
"@version": 1.1,
"dct": "http://purl.org/dc/terms/",
"title": { "@id": "dct:title", "@container": "@language" },
"description": { "@id": "dct:description", "@container": "@language" },
"modified": "dct:modified"
},
"title": {
"en": "Page feedback tool",
"fr": "Outil de rétroaction sur la page"
},
"description": {
"en": "Page feedback tool for Canada.ca",
"fr": "Outil de rétroaction sur la page pour Canada.ca"
},
"modified": "2022-12-06",
"componentName": "gc-page-feedback",
"status": "stable",
"pages": {
"examples": [
{
"title": "Page feedback tool",
"language": "en",
"path": "gc-page-feedback-en.html"
},
{
"title": "Outil de rétroaction sur la page",
"language": "fr",
"path": "gc-page-feedback-fr.html"
},
{
"title": "Page feedback tool with custom parameters",
"language": "en",
"path": "gc-page-feedback-custom-en.html"
},
{
"title": "Outil de rétroaction sur la page avec paramètres personnalisés",
"language": "fr",
"path": "gc-page-feedback-custom-fr.html"
}
]
}
}
,{
"@context": {
"@version": 2.0,
Expand Down
12 changes: 12 additions & 0 deletions _includes/gc-page-feedback/gc-page-feedback.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
NOTES:
-For testing/ease of development
-Only works when pageDetails is enabled in "/sites/gc-page-feedback/*.html"
-Remove this file before merging
-->
{%- if page.dir == "/sites/gc-page-feedback/" -%}
{%- include_relative includes/css.html -%}
{%- include_relative includes/gc-page-feedback.html -%}
{%- else -%}
<p><strong>Error:</strong> The page feedback tool only can only be activated in pages located at "sites/gc-page-feedback/*.html".</p>
{%- endif -%}
45 changes: 45 additions & 0 deletions _includes/page-details/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
NOTES:
-For testing/ease of development
-Remove this file before merging
-->
<footer class="pagedetails{% if include.addContainer %} container{% endif %}">
<h2 class="wb-inv">{{ i18nText-pageDetails }}</h2>

{% assign col-modified = "col-xs-12" %}
{%- if page.pageFeedback or page.noReportProblem != true -%}
{% assign col-feedback = "col-sm-8 col-md-9 col-lg-9" %}
{%- if page.share -%}
{% assign col-share = "col-sm-4 col-md-3" %}
{%- endif -%}
{%- else -%}
{%- if page.share -%}
{% assign col-share = "col-sm-4 col-md-3 col-sm-push-8 col-md-push-9" %}
{% assign col-modified = "col-sm-6 col-md-5 col-lg-4 col-sm-pull-4 col-md-pull-3" %}
{%- endif -%}
{%- endif -%}

<div class="row">
{%- if page.pageFeedback or page.noReportProblem != true -%}
<div class="{{ col-feedback }}">
{%- if page.pageFeedback -%}
{% include gc-page-feedback/gc-page-feedback.html %}
{%- else -%}
{%- unless page.noReportProblem -%}
{% include feedback/feedback.html %}
{%- endunless -%}
{%- endif -%}
</div>
{%- endif -%}
{%- if page.share -%}
<div class="wb-share {{ col-share }}" data-wb-share='{"lnkClass": "btn btn-default btn-block"}'></div>
{%- endif -%}

<div class="{{ col-modified }}">
<dl id="wb-dtmd">
<dt>{{ i18nText-dateModified }}</dt>
<dd><time property="dateModified">{{ page.dateModified }}</time></dd>
</dl>
</div>
</div>
</footer>
90 changes: 10 additions & 80 deletions components/provisional-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{ "title": "GCWeb home", "link": "https://wet-boew.github.io/themes-dist/GCWeb/index-en.html" }
],
"secondlevel": false,
"dateModified": "2021-01-19",
"dateModified": "2022-12-06",
"share": "true"
}
---
Expand Down Expand Up @@ -93,9 +93,16 @@ <h3>Provisional feature removal first notice</h3>
</tr>
<tr>
<th>Template <code>.gc-pg-hlpfl</code></th>
<td>"Page success widget" design pattern to let users share their experience on the page.</td>
<td>
<p>"Page success widget" design pattern to let users share their experience on the page.</p>
<p>Feature has been revised and renamed to "page feedback tool" (<code>.gc-pft</code>):</p>
<ul>
<li><a href="../sites/gc-page-feedback/gc-page-feedback-en.html">Page feedback tool - Canada.ca site functionality</a></li>
<li><a href="../sites/gc-page-feedback/gc-page-feedback-custom-en.html">Page feedback tool with custom parameters - Canada.ca site functionality</a></li>
</ul>
</td>
<td>v7.0</td>
<td></td>
<td>Stable (vX.X.X) (TODO)</td>
</tr>
<tr>
<th>Plugin <code>.wb-chtwzrd</code></th>
Expand Down Expand Up @@ -402,80 +409,3 @@ <h3 id="icon-warning">Icon warning color</h3>
<span class="glyphicon glyphicon-warning-sign provisional icon-warning-light mrgn-rght-md"></span> With "provisional icon-warning-light" class
</p>
</div>
<h3 id="gc-pg-hlpfl">Page success widget</h3>
<p>Planned to eventually replace Report a problem. Uses multiple features: <code>wb-postback</code> and <code>data-wb-doaction</code> plugins, as well as <code>nojs-*</code> styles and Font Awesome.</p>
<div class="row row-no-gutters mrgn-tp-xl">
<div class="col-sm-7 col-lg-6">
<section class="provisional gc-pg-hlpfl">
<div class="well mrgn-bttm-0">
<form id="gc-pg-hlpfl-frm" action="index-en.html" method="post" autocomplete="off" class="provisional wb-postback" data-wb-postback="{&quot;success&quot;:&quot;.gc-pg-hlpfl-thnk&quot;,&quot;content&quot;:&quot;#gc-pg-hlpfl-frm&quot;}">
<input type="hidden" name="pageTitle" value="Provisional functionality - GCWeb theme">
<input type="hidden" name="submissionPage" value="https://wet-boew.github.io/themes-dist/GCWeb/provisional-en.html">
<input type="hidden" name="tid" value="1234">
<input type="hidden" name="auke" value="5678">
<div class="gc-pg-hlpfl-btn">
<div class="row row-no-gutters">
<div class="col-xs-12 col-sm-7 mrgn-tp-sm">
<h2 class="mrgn-tp-sm h5">Did you find what you were looking for?</h2>
</div>
<div class="col-xs-8 col-sm-5 text-right">
<button type="submit" name="helpful" value="Yes" class="btn btn-primary">Yes</button>
<button type="button" class="btn btn-primary mrgn-lft-sm nojs-hide" data-wb-doaction="[
{&quot;action&quot;:&quot;removeClass&quot;,&quot;source&quot;:&quot;.gc-pg-hlpfl-no&quot;,&quot;class&quot;:&quot;nojs-show&quot;},
{&quot;action&quot;:&quot;addClass&quot;,&quot;source&quot;:&quot;.gc-pg-hlpfl-btn&quot;,&quot;class&quot;:&quot;hide&quot;}
]">No</button>
</div>
</div>
</div>
<p class="h3 hidden nojs-show">If not, tell us why:</p>
<div class="gc-pg-hlpfl-no nojs-show">
<fieldset>
<legend class="h4 mrgn-tp-0 mrgn-bttm-md">What was wrong?</legend>
<div class="radio">
<label>
<input name="problem" id="problem01" type="radio" value="The answer I need is missing">
The answer I need is missing
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem02" type="radio" value="The information isn’t clear">
The information isn’t clear
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem03" type="radio" value="I’m not in the right place">
I’m not in the right place
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem04" type="radio" value="Something is broken or incorrect">
Something is broken or incorrect
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem05" type="radio" value="Other reason">
Other reason
</label>
</div>
</fieldset>
<label for="problem06">Please provide more details</label>
<p class="small">
<strong>(Don’t include any personal information)</strong>
<br>
<span class="small">Maximum 300 characters</span>
</p>
<textarea name="details" id="problem06" class="full-width" maxlength="300"></textarea>
<button type="submit" name="helpful" value="No" class="btn btn-primary mrgn-tp-md mrgn-bttm-sm">Submit</button>
</div>
</form>
<div class="gc-pg-hlpfl-thnk hide">
<p class="h6 mrgn-tp-sm mrgn-bttm-sm"><span class="far fa-check-circle text-success mrgn-rght-sm" aria-hidden="true"></span> Thank you for your feedback</p>
</div>
</div>
</section>
</div>
</div>
91 changes: 10 additions & 81 deletions components/provisional-fr.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{ "title": "Accueil GCWeb", "link": "https://wet-boew.github.io/themes-dist/GCWeb/index-fr.html" }
],
"secondlevel": false,
"dateModified": "2021-01-19",
"dateModified": "2022-12-06",
"share": "true"
}
---
Expand Down Expand Up @@ -95,9 +95,16 @@ <h3>Provisional feature removal first notice</h3>
</tr>
<tr>
<th>Gabarit <code>.gc-pg-hlpfl</code></th>
<td>"Widget succès de page" configuration de conception pour laisser les utilisateurs partager leur expérience sur la page.</td>
<td>
<p>"Widget succès de page" configuration de conception pour laisser les utilisateurs partager leur expérience sur la page.</p>
<p>Cette fonctionnalité a été révisée et renommée «&nbsp;outil de rétroaction sur la page&nbsp;» (<code>.gc-pft</code>)&nbsp;:</p>
<ul>
<li><a href="../sites/gc-page-feedback/gc-page-feedback-fr.html">Outil de rétroaction sur la page - Fonctionnalité du site Canada.ca</a></li>
<li><a href="../sites/gc-page-feedback/gc-page-feedback-custom-fr.html">Outil de rétroaction sur la page avec paramètres personnalisés - Fonctionnalité du site Canada.ca</a></li>
</ul>
</td>
<td>v7.0</td>
<td></td>
<td>Stable (vX.X.X) (TODO)</td>
</tr>
<tr>
<th>Plugin <code>.wb-chtwzrd</code></th>
Expand Down Expand Up @@ -408,81 +415,3 @@ <h3 id="#icon-warning">Icon warning color</h3>
</p>
</div>
</div>
<h3 id="gc-pg-hlpfl">Widget succès de page</h3>
<p>Est prévu pour remplacer Signaler un problème ou une erreur sur cette page éventuellement. Utilises plusieurs fonctionnalités&nbsp;: les plugiciels <code>wb-postback</code> et <code>data-wb-doaction</code>, ainsi que les styles <code>nojs-*</code> puis Font Awesome.</p>
<div class="row row-no-gutters mrgn-tp-xl">
<div class="col-sm-7 col-lg-6">
<section class="provisional gc-pg-hlpfl">
<div class="well mrgn-bttm-0">
<form id="gc-pg-hlpfl-frm" action="index-fr.html" method="get" autocomplete="off" class="provisional wb-postback" data-wb-postback="{&quot;success&quot;:&quot;.gc-pg-hlpfl-thnk&quot;,&quot;content&quot;:&quot;#gc-pg-hlpfl-frm&quot;}">
<input type="hidden" name="pageTitle" value="Fonctionalités provisoires - Thème de GCWeb">
<input type="hidden" name="submissionPage" value="https://wet-boew.github.io/themes-dist/GCWeb/provisional-fr.html">
<input type="hidden" name="tid" value="1234">
<input type="hidden" name="auke" value="5678">
<div class="gc-pg-hlpfl-btn">
<div class="row row-no-gutters">
<div class="col-xs-12 col-sm-7 mrgn-tp-sm">
<h2 class="mrgn-tp-sm h5">Avez-vous trouvé ce que vous cherchiez?</h2>
</div>
<div class="col-xs-8 col-sm-5 text-right">
<button type="submit" name="helpful" value="Yes" class="btn btn-primary">Oui</button>
<button type="button" class="btn btn-primary mrgn-lft-sm nojs-hide" data-wb-doaction="[
{&quot;action&quot;:&quot;removeClass&quot;,&quot;source&quot;:&quot;.gc-pg-hlpfl-no&quot;,&quot;class&quot;:&quot;nojs-show&quot;},
{&quot;action&quot;:&quot;addClass&quot;,&quot;source&quot;:&quot;.gc-pg-hlpfl-btn&quot;,&quot;class&quot;:&quot;hide&quot;}
]">Non</button>
</div>
</div>
</div>
<p class="h3 hidden nojs-show">Sinon, dites nous pourquoi&nbsp;:</p>
<div class="gc-pg-hlpfl-no nojs-show">
<fieldset>
<legend class="h4 mrgn-tp-0 mrgn-bttm-md">Qu’est-ce qui n’allait pas?</legend>
<div class="radio">
<label>
<input name="problem" id="problem01" type="radio" value="I can’t find what I’m looking for">
La réponse dont j’ai besoin n’est pas là
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem02" type="radio" value="The information isn’t clear">
L'information n'est pas claire
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem03" type="radio" value="I’m not in the right place">
Je ne suis pas au bon endroit
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem04" type="radio" value="Something is broken or incorrect">
Quelque chose est brisé ou incorrect
</label>
</div>
<div class="radio">
<label>
<input name="problem" id="problem05" type="radio" value="Other reason">
Autre raison
</label>
</div>
</fieldset>
<label for="problem06">Veuillez fournir plus de détails</label>
<p class="small">
<strong>(N’incluez pas d’information personnelle)</strong>
<br>
<span class="small">Maximum de 300 caractères</span>
</p>
<textarea name="details" id="problem06" class="full-width" maxlength="300"></textarea>
<br>
<button type="submit" name="helpful" value="No" class="btn btn-primary mrgn-tp-md mrgn-bttm-sm">Soumettre</button>
</div>
</form>
<div class="gc-pg-hlpfl-thnk hide">
<p class="h6 mrgn-tp-sm mrgn-bttm-sm"><span class="far fa-check-circle text-success mrgn-rght-sm" aria-hidden="true"></span> Merci de vos commentaires</p>
</div>
</div>
</section>
</div>
</div>
24 changes: 24 additions & 0 deletions sites/gc-page-feedback/_base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
@title: Page feedback tool - Base
*/

/* In noscript/basic HTML mode... */
.no-js,
.wb-disable {
.gc-pft {
/* Disable row gutters (default selector isn't specific-enough) */
.row-no-gutters {
@extend .row-no-gutters;
}

/* Make the legend full width */
.nojs-col-sm-12 {
@extend .col-sm-12;
}

/* Left-align the legend and yes/no buttons */
.nojs-text-left {
text-align: left;
}
}
}
7 changes: 7 additions & 0 deletions sites/gc-page-feedback/_print.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
@title: Page feedback tool - Print view
*/

.gc-pft {
@extend %gcweb-print-display-none-important;
}
14 changes: 14 additions & 0 deletions sites/gc-page-feedback/_screen-sm-min.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
@title: Page feedback tool - Small view and over
*/

/* In noscript/basic HTML mode... */
.no-js,
.wb-disable {
.gc-pft {
/* Disable the legend's right padding */
.nojs-pr-sm-0 {
padding-right: 0 !important;
}
}
}
Loading

0 comments on commit 07ae8b3

Please sign in to comment.