Skip to content

Ensure focused search input in header renders consistently across breakpoints #1317

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

Merged
merged 9 commits into from
May 27, 2025
9 changes: 7 additions & 2 deletions packages/components/header/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ $_header-item-padding: 12px;
.nhsuk-header__search-input.nhsuk-input {
border-color: transparent;
border-radius: $nhsuk-border-radius 0 0 $nhsuk-border-radius;
font-size: $nhsuk-base-font-size;
height: 40px;
margin-right: -$nhsuk-border-width-form-element;
padding: 0 $_header-item-padding;
padding-right: $_header-item-padding;
padding-left: $_header-item-padding - $nhsuk-border-width-form-element;
Comment on lines +208 to +209
Copy link
Contributor

@colinrotherham colinrotherham May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Right padding was good
    We've already used -2px margin to hide the 2px transparent border

  2. Left padding appeared 2px too wide (14px not 12px)
    For comparison see screenshot in comment above

width: 100%;
@include nhsuk-font-size(16);

&:focus {
z-index: 10;
Expand All @@ -198,6 +199,10 @@ $_header-item-padding: 12px;
color: $color_nhsuk-grey-1;
opacity: 1; // Fixes low contrast of placeholder text in firefox
}

@include nhsuk-media-query($until: tablet) {
font-size: inherit;
}
}

.nhsuk-header__search-submit {
Expand Down