Problem/Motivation

We're adding a search link to mobile devices.

Use story

As an anonymous user
I want a search link to be available on my mobile device
So that I can easily get to the search page

As a product owner of a website using CivicTheme
I want search on mobile to be available OOTB
So I don't have to customise my site to make it available

Acceptance criteria

Given I'm a site builder
When I set up my site
Then I can select whether the search link displays in the header or the menu on mobile devices

AC 1 - Link position
GIVEN I'm an anonymous user using a mobile device
WHEN I open the primary menu
THEN the search menu link and icon is available at the bottom of the menu
AND when I tap on the menu link I am taken to the search page

AC2 - Keyboard focus
GIVEN I'm an anonymous user
WHEN I use the tab key to move focus to a search input
THEN I see the button is focused using a visual indicator
THEN when I use the enter or spacebar key I am taken to the search page

AC3 - Mobile screenreader
GIVEN I'm an anonymous user
WHEN I use a mobile screenreader
AND I swipe to focus on a search input
THEN I hear its purpose is clear
AND I hear it identifies itself as a search input
AND I hear the form itself is discoverable with screenreader shortcuts as search landmark

AC4 - Site Administrator can control whether search block link appears in Mobile menu
Given I am a site administrator
When I am configuring my search block
Then I can select the search box to appear in the Mobile Menu
And the mobile menu will now contain a search link

Proposed resolution

@molecules/search/search.twig to show on mobile.
a. Remove the hide-xxs show-m-flex classes.
b. Set attributes with aria-label="Search" and check reads out correctly on screen readers.
c. In block config, place the mobile menu after search
d. Update the header theming to remove the position: absolute; top: 50%; transform: translateY(-50%); right: 0; from .ct-header .ct-mobile-navigation-trigger.

Add a field to /admin/structure/block-content/manage/civictheme_search/fields to "Show link in mobile menu".

In _civictheme_preprocess_block__civictheme_mobile_navigation:
a. Add query to get all blocks with the "Show link in mobile menu" selected
b. Use the link field in the search block to append a new link to the bottom of the mobile menu.
c. The new link added should also set an icon of magnifier.

In /mobile-navigation/mobile-navigation-menu.twig add the ability to have parameter items with an icon
a. Pass the icon parameter into the link.twig components. Icon should have a placement of before.

Add any additional styling, config or code cleanup.

CommentFileSizeAuthor
#9 Search button - mobile view.png448.88 KBdanielgry

Comments

fionamorrison23 created an issue. See original summary.

fionamorrison23’s picture

Issue summary: View changes
fionamorrison23’s picture

Assigned: Unassigned » danielgry
Status: Active » Needs review

fionamorrison23’s picture

danielgry’s picture

Issue summary: View changes
StatusFileSize
new448.88 KB

Verified and tested on latest dev version

Testing Results:
1. Verified the search link appears in the header on mobile as configured
2. Validated screen reader behaviour recognises the search button
3. Checked that the search placement is configurable in the Drupal backend

Screenshot:

danielgry’s picture

Assigned: danielgry » richardgaunt
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
richardgaunt’s picture

Issue summary: View changes

  • febdao authored b7a3b4a1 on 1.x
    Issue #3506586 by danielgry, fionamorrison23, richardgaunt, alan.cole,...
richardgaunt’s picture

Version: 1.9.0 » 1.10.0
Status: Reviewed & tested by the community » Fixed
fionamorrison23’s picture

Version: 1.10.0 » 1.9.0
fionamorrison23’s picture

Version: 1.9.0 » 1.10.0

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.