Skip to content

fix: align focus ring on search input to container border#12069

Merged
lokesh merged 2 commits into
internetarchive:masterfrom
akramcodez:fix/search-input-focus-ring-alignment
Mar 16, 2026
Merged

fix: align focus ring on search input to container border#12069
lokesh merged 2 commits into
internetarchive:masterfrom
akramcodez:fix/search-input-focus-ring-alignment

Conversation

@akramcodez
Copy link
Copy Markdown
Contributor

Closes #12067

fix: The focus ring (outline) on the Search Books page was appearing on the inner <input> element, causing it to look offset/misaligned from the visible container border.

Technical

The .searchbox container holds the visible border and border-radius, but the browser's default focus ring was drawn on the child <input> — which sits inset inside the container — making the ring appear misaligned.

Fix in static/css/components/searchbox.css:

  • Added outline: none to .searchbox__input to suppress the misaligned default ring
  • Added outline: auto on .searchbox:focus-within so the ring is drawn on the outer container, perfectly hugging its border

Testing

  1. Go to http://openlibrary.org/search?mode=everything
  2. Click inside the search input field
  3. Verify the focus ring now aligns with the container border

Screenshot

Before
image

After
Screenshot 2026-03-11 114512

Stakeholders

@lokesh

Copilot AI review requested due to automatic review settings March 11, 2026 06:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the misaligned focus ring on the Search Books page by moving the focus indicator from the inset <input> to the outer .searchbox container.

Changes:

  • Removed the default focus outline from .searchbox__input.
  • Added a :focus-within outline to .searchbox so the focus ring aligns with the container border.

Comment thread static/css/components/searchbox.css Outdated
}

.searchbox:focus-within {
outline: auto;
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

.searchbox:focus-within { outline: auto; } will rely on UA-defined focus styling, which can vary across browsers and may not align with the design tokens used elsewhere. Consider using the existing focus ring token (e.g. box-shadow: var(--box-shadow-focus) from static/css/tokens/borders.css) for a consistent, themeable focus indicator (and to better match the component’s border-radius).

Suggested change
outline: auto;
outline: none;
box-shadow: var(--box-shadow-focus);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@akramcodez can you try this suggestion and share a screenshot. We are working on standardizing the visual style of our focus states by utilizing these css custom properties/variables.

Comment thread static/css/components/searchbox.css Outdated
}

.searchbox:focus-within {
outline: auto;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@akramcodez can you try this suggestion and share a screenshot. We are working on standardizing the visual style of our focus states by utilizing these css custom properties/variables.

@akramcodez
Copy link
Copy Markdown
Contributor Author

Thanks! @lokesh, I’ve updated it to use box-shadow: var(--box-shadow-focus) as suggested. Sharing the updated screenshot.
Screenshot 2026-03-14 115304

@github-actions github-actions Bot added the Needs: Response Issues which require feedback from lead label Mar 14, 2026
@lokesh lokesh merged commit cb5b3de into internetarchive:master Mar 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search input focus ring is misaligned on the Search Books page

3 participants