Problem/Motivation

The search box can become too long since it adjusts to the viewport of the browser window. On a 36" monitor and the browser window extended to the maximum of the screen you are able to enter up to 472 characters (and more). From a readability and cognition standpoint the line length shouldnt exceed ~80 characters (WCAG2.2. SC 1.4.8). In a similar vein was the recommendation from the folks at Smashing Magazine in the Search UX webinar. You should aim for 60+ characters on desktop and around 45 characters on mobile for the search box width.

Steps to reproduce

Proposed resolution

Reduce the maximum width of the search field or make it even a fixed width?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rkoller created an issue. See original summary.

Tabestan made their first commit to this issue’s fork.

tabestan’s picture

Status: Active » Needs review

This proposed solution reduces the search box maxlength to 80 characters on desktop and 45 characters on screens smaller than 768px.

r.aubin’s picture

Status: Needs review » Needs work

@rkoller, was the intent of this issue to reduce the allowable character length of this input or the visible width of the input field?

Adjusting the width of the input based on viewport size so it doesn't end up really wide would be nice, but is a separate thing from the allowable input character length. Also, the WCAG section you referenced pertains to blocks of text, not form inputs, so I don't think that should apply here and the input's maxLength shouldn't be different for users with different viewport sizes.

The open MR that @Tabestan put together addresses just the maxLength not the input's physical size.

Gauravvvv made their first commit to this issue’s fork.

gauravvvv’s picture

Status: Needs work » Needs review

I have updated the physical width of the search box for desktop and mobile device as 80ch and 45ch respectively for desktop and mobile devices.

kanchan bhogade’s picture

Status: Needs review » Needs work

MR is failing and in the Issue summary also MR is "Open Failed Pipeline"

Moving ti "needs work"

gauravvvv’s picture

Status: Needs work » Needs review

MR is passing the tests now.

zetagraph’s picture

@tabestan, @rkoller we are rearranging things visually in this issue

The search box is going to always span the full width of the browser window. There is no need to limit the box width or the character count as far as I can tell.

CC: @raubin, @gauravvvv

chrisfromredfin’s picture