-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mntor 1564 - Add Survey Recruitment Link #3030
Conversation
b778f5a
to
fc957ce
Compare
src/views/mainLayout.js
Outdated
} | ||
|
||
const recruitmentBanner = () => ` | ||
<div role="banner" class="recruitment-banner" hidden> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a11y note: Added "banner" type aria role to the element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looking at that page, that doesn't seem appropriate for this use case? Our site already has a <header>
, which has the same role, and:
each page should generally be limited to a single element with the role of banner.
It also says:
The banner typically includes things such as a logo or corporate identity, or possibly a site-specific search tool, and is generally what your marketing team would call the "header" or "top banner" of the site.
Which I don't think it is.
That said, always 👏 for giving a11y some thought!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, and since it's within that <header>
it would even be a banner inside a banner 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in ad11567
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me, not much to add to Kaitlyn and Peter's comments.
src/views/mainLayout.js
Outdated
} | ||
|
||
const recruitmentBanner = () => ` | ||
<div role="banner" class="recruitment-banner" hidden> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looking at that page, that doesn't seem appropriate for this use case? Our site already has a <header>
, which has the same role, and:
each page should generally be limited to a single element with the role of banner.
It also says:
The banner typically includes things such as a logo or corporate identity, or possibly a site-specific search tool, and is generally what your marketing team would call the "header" or "top banner" of the site.
Which I don't think it is.
That said, always 👏 for giving a11y some thought!
src/views/mainLayout.js
Outdated
<button id="recruitment-dismiss" class="dismiss-btn"> | ||
<svg class="x-close-icon" role="button" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M14.348 14.849a1.2 1.2 0 0 1-1.697 0L10 11.819l-2.651 3.029a1.2 1.2 0 1 1-1.697-1.697l2.758-3.15-2.759-3.152a1.2 1.2 0 1 1 1.697-1.697L10 8.183l2.651-3.031a1.2 1.2 0 1 1 1.697 1.697l-2.758 3.152 2.758 3.15a1.2 1.2 0 0 1 0 1.698z"/></svg> | ||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This button doesn't currently have a text equivalent (e.g. "Close" or "Dismiss"). Alt text for embedded SVGs are a bit of a hassle (I think you need both an aria-label
and a <title>
element, although the latter will also make the alt text visible on hover), but perhaps you could add an aria-label
to the button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added aria-label="Close"
to the SVG in ad11567
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a heads-up that that will need to be localised as well :)
Edit: stole Peter's genius it seems like :)
src/views/mainLayout.js
Outdated
} | ||
|
||
const recruitmentBanner = () => ` | ||
<div role="banner" class="recruitment-banner" hidden> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, and since it's within that <header>
it would even be a banner inside a banner 😅
|
||
switch (true) { | ||
case e.target.matches('#recruitment-banner-dimiss'): | ||
document.getElementById('recruitment-banner-link').parentElement.remove() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Do we need to remove the link/button event listeners here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same question myself here: #3030 (comment) I'll ask UX and follow-up!
Nevermind. I misread your question. Looking into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welp, I'm quoting StackOverflow here:
In modern browsers, you do not need to remove event listeners before removing elements from the DOM. If there are no direct references to that particular DOM element elsewhere in your javascript (e.g. the DOM element reference stored in a JS variable), then the DOM element will be garbage collected after removal. The DOM garbage collector is smart enough to know that an event listener does not count as a reference to that DOM element once it's been removed from the DOM (because DOM events cannot happen when it is removed from the DOM).
I think it's parents' removal is enough to break the references.
Unless the references on L16/L17 are still "references" in memory. I was gonna let QA see what breaks from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only other thing I could do is directly remove the entire banner, rather than the .parentElement
bit.
document.getElementById('recruitment-banner-link').parentElement.remove() | |
recruitmentBanner.remove() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you address Peter's comments I think this is good to go by now :)
…nglish-speaking users
Code review suggestions: Updated comment and CSS fix for padding Co-authored-by: Kaitlyn Andres <[email protected]> Co-authored-by: Vincent <[email protected]>
f42f37e
to
1813bc7
Compare
* main: (25 commits) fix: use new error classes from cloud function (#3064) Rename cloud-functions dir, and make missing required env vars warning not error (#3059) Mntor 1539/separate data ingestion (#3034) Merge `main` into `localization` (#3052) Fix MNTOR-1598 - Add wrapper to input form on homepage breach scan (#3045) Mntor 1564 - Add Survey Recruitment Link (#3030) ADR Proposal: Add React Framework (#3019) chore: Remove FluentError chore: Set default error message Delete styleGuide.js add localized text add more descriptive alt attribute for mainlayout MNTOR-1471 - Add missing alt/aria-label attributes on img elements chore: Use enum for the toast type chore: Throw errors with new chore: Omit redundant error message fix: FluentError test chore: Add tests for error classes fix: ClientError import path chore: Remove option to redirect from ClientError ...
Summary
This PR adds a survey recruitment link to the top of the page for logged-in/English speaking users.
Acceptance Criteria
References:
Jira: MNTOR-1564
Figma: N/A
Testing
To show the recruitment link, three items must be true:
.env
:RECRUITMENT_BANNER_LINK=https://survey.alchemer.com/s3/6785097/9ee8eccacd7b
RECRUITMENT_BANNER_TEXT=Tell us about your experience with Firefox Monitor and receive a $100 Amazon gift card.
en
,en-us
, etc).To "reset" this banner, you'll need to delete a cookie. You can do that by:
http://localhost:6060
pagehttp://localhost:6060
recruited
cookiePlease reset your app between each test.
Test: Click Survey Link
Test: Click Dismiss Link on Survey
Test: Set Browser to non-English language
de
)Checklist (Definition of Done)
Screenshots