From a9941f8a4910dbcce4fb6752188d3a2a78bda4ac Mon Sep 17 00:00:00 2001 From: Paul Clue <67766160+Paul-Clue@users.noreply.github.com> Date: Wed, 23 Nov 2022 09:13:22 -0500 Subject: [PATCH 1/2] Add aria-label to search icon --- src/components/navigation/www/navigation.jsx | 203 ++++++++++--------- 1 file changed, 109 insertions(+), 94 deletions(-) diff --git a/src/components/navigation/www/navigation.jsx b/src/components/navigation/www/navigation.jsx index 245a5797c..6f1d6b98e 100644 --- a/src/components/navigation/www/navigation.jsx +++ b/src/components/navigation/www/navigation.jsx @@ -25,11 +25,7 @@ require('./navigation.scss'); class Navigation extends React.Component { constructor (props) { super(props); - bindAll(this, [ - 'getProfileUrl', - 'handleSearchSubmit', - 'pollForMessages' - ]); + bindAll(this, ['getProfileUrl', 'handleSearchSubmit', 'pollForMessages']); // Keep the timeout id so we can cancel it (e.g. when we unmount) this.messageCountTimeoutId = -1; } @@ -37,7 +33,10 @@ class Navigation extends React.Component { if (this.props.user) { // Setup polling for messages to start in 2 minutes. const twoMinInMs = 2 * 60 * 1000; - this.messageCountTimeoutId = setTimeout(this.pollForMessages.bind(this, twoMinInMs), twoMinInMs); + this.messageCountTimeoutId = setTimeout( + this.pollForMessages.bind(this, twoMinInMs), + twoMinInMs + ); } } componentDidUpdate (prevProps) { @@ -45,7 +44,10 @@ class Navigation extends React.Component { this.props.handleCloseAccountNav(); if (this.props.user) { const twoMinInMs = 2 * 60 * 1000; - this.messageCountTimeoutId = setTimeout(this.pollForMessages.bind(this, twoMinInMs), twoMinInMs); + this.messageCountTimeoutId = setTimeout( + this.pollForMessages.bind(this, twoMinInMs), + twoMinInMs + ); } else { // Clear message count check, and set to default id. if (this.messageCountTimeoutId !== -1) { @@ -57,7 +59,7 @@ class Navigation extends React.Component { } } componentWillUnmount () { - // clear message interval if it exists + // clear message interval if it exists if (this.messageCountTimeoutId !== -1) { clearTimeout(this.messageCountTimeoutId); this.props.setMessageCount(0); @@ -74,7 +76,8 @@ class Navigation extends React.Component { // We only poll if it has been less than 32 minutes. // Chances of someone actively using the page for that long without // a navigation is low. - if (ms < 32 * 60 * 1000) { // 32 minutes + if (ms < 32 * 60 * 1000) { + // 32 minutes const nextFetch = ms * 2; // exponentially back off next fetch time. const timeoutId = setTimeout(() => { this.pollForMessages(nextFetch); @@ -85,7 +88,7 @@ class Navigation extends React.Component { handleSearchSubmit (formData) { if (formData.q.trim() === '') return; // don't submit empty searches - + let targetUrl = '/search/projects'; if (formData.q) { targetUrl += `?q=${encodeURIComponent(formData.q)}`; @@ -93,7 +96,9 @@ class Navigation extends React.Component { window.location.href = targetUrl; } render () { - const createLink = this.props.user ? '/projects/editor/' : '/projects/editor/?tutorial=getStarted'; + const createLink = this.props.user ? + '/projects/editor/' : + '/projects/editor/?tutorial=getStarted'; return (