From b099a3843d0cc40ce2c8fe2a100ffa99f43fd744 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Mon, 20 Sep 2021 16:06:15 +0100 Subject: [PATCH] [A11Y] Accessibility improvements for the Search component (#3017) * Remove deprecated code * Accessibility improvements for Search component --- .../core/js/src/forum/components/Search.tsx | 35 +++++++++++------- framework/core/less/common/Search.less | 11 ++++++ .../less/common/mixins/accessibility.less | 36 +++++++++++++++++++ framework/core/locale/core.yml | 2 ++ 4 files changed, 71 insertions(+), 13 deletions(-) diff --git a/framework/core/js/src/forum/components/Search.tsx b/framework/core/js/src/forum/components/Search.tsx index e6355a956..b4793eab4 100644 --- a/framework/core/js/src/forum/components/Search.tsx +++ b/framework/core/js/src/forum/components/Search.tsx @@ -103,14 +103,18 @@ export default class Search extends Compone const searchLabel = extractText(app.translator.trans('core.forum.header.search_placeholder')); + const isActive = !!currentSearch; + const shouldShowResults = !!(!this.loadingSources && this.state.getValue() && this.hasFocus); + const shouldShowClearButton = !!(!this.loadingSources && this.state.getValue()); + return (
@@ -125,18 +129,23 @@ export default class Search extends Compone onfocus={() => (this.hasFocus = true)} onblur={() => (this.hasFocus = false)} /> - {this.loadingSources ? ( - - ) : currentSearch ? ( - - ) : ( - '' )}
-