Skip to content
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

Fix search component label background #1983

Merged
merged 1 commit into from
Mar 18, 2021
Merged

Fix search component label background #1983

merged 1 commit into from
Mar 18, 2021

Conversation

andysellick
Copy link
Contributor

What

Change the search component's label so that it looks less broken. This is surprisingly complex. There are several variants to consider:

  • default behaviour
  • on a blue background
  • without a border, typically on a black background (referred to in the code as on a white background, confusingly)

For each variant of the component, we have to consider the following conditions.

  • JS enabled: the label overlays the input, disappearing when clicked
  • JS disabled: the label appears prior to the input (this is where the problem is)
  • linearized: the label appears prior to the input, but JS may be enabled or disabled

The linearized state was highlighted in a past accessibility audit as not being displayed properly. A fix was applied. To see this page state, choose Linearize Page in the miscellaneous tab of web developer toolbar.

Screenshot 2021-03-18 at 12 43 55

Why

Fixes #1824

Visual Changes

This change fixes the appearance of the component when JS is disabled on a blue background. It shouldn't change the behaviour of anything else. Note that if JS is enabled and the page is linearized, it still looks broken as reported in #1824 but I don't think there's anything that can be done about that - there's no way to detect if a user has enabled this feature.

Before After
Screenshot 2021-03-18 at 12 50 16 Screenshot 2021-03-18 at 12 50 33

@bevanloon bevanloon temporarily deployed to govuk-publis-fix-search-wepadn March 18, 2021 12:51 Inactive
@andysellick andysellick changed the title [DO NOT MERGE] Fix search component label background Fix search component label background Mar 18, 2021
@bevanloon bevanloon temporarily deployed to govuk-publis-fix-search-wepadn March 18, 2021 13:57 Inactive
@andysellick andysellick marked this pull request as ready for review March 18, 2021 14:06
@bevanloon bevanloon temporarily deployed to govuk-publis-fix-search-wepadn March 18, 2021 16:45 Inactive
@andysellick andysellick merged commit 24d4692 into master Mar 18, 2021
@andysellick andysellick deleted the fix-search-label branch March 18, 2021 16:56
alex-ju added a commit that referenced this pull request Mar 19, 2021
* Add GOVUK Frontend Details module to GOVUK Modules and amend `modules.js` start function ([PR #1985](#1985))
* Rescope Brexit CTA to en/cy locale only ([PR #1984](#1984))
* Add JavaScript tests for accordion component ([PR #1977](#1977))
* Fix search component label background ([PR #1983](#1983))
* Allow emergency banner and global bar in public layout component ([PR #1978](#1915))
@alex-ju alex-ju mentioned this pull request Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search component layout looks broken when JavaScript is disabled
3 participants