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

Algolia search field collapse behaviour #250

Closed
nico-bachner opened this issue Feb 27, 2021 · 0 comments · Fixed by #286
Closed

Algolia search field collapse behaviour #250

nico-bachner opened this issue Feb 27, 2021 · 0 comments · Fixed by #286
Labels
enhancement New feature or request

Comments

@nico-bachner
Copy link
Contributor

Describe the bug
Between screen sizes 720px and 751px, the search field is collapsed, but still takes up the space of the expanded version:

Screenshot of VitePress homepage

This issue seems to be baked into the VitePress default theme.

To Reproduce
Steps to reproduce the behavior:

  1. Open a device with screen width larger than 800px (laptop or desktop).
  2. Visit any VitePress site (example: https://vitepress.vuejs.org).
  3. Slowly resize the browser window, paying special attention when getting to the 751px threshold.
  4. Done.

Expected behavior
A clear and concise description of what you expected to happen.

The search field should only collapse at screen sizes smaller than 720px.

System Info

Additional context
Add any other context about the problem here.

From https://github.com/vuejs/vitepress/blob/master/src/client/theme-default/components/AlgoliaSearchBox.vue:

@media (min-width: 720px) {
  .algolia-search-box {
    padding-left: 8px;
    min-width: 176.3px; /* avoid layout shift */
  }
}
@media (min-width: 751px) {
  .algolia-search-box {
    padding-left: 8px;
  }
  .algolia-search-box .DocSearch-Button-Placeholder {
    padding-left: 8px;
    font-size: 0.9rem;
    font-weight: 500;
  }
}

I still don't quite understand the purpose of the @media (min-width: 751px) {...}, since in other default theme components, the screen width breakpoint is at 720px, but it seems to me that combining the two media queries should solve the problem.

Another solution might be to simply move the min-width: 176.3px; under the @media (min-width: 751px) {...) section.

@nico-bachner nico-bachner added the bug: pending triage Maybe a bug, waiting for confirmation label Feb 27, 2021
@posva posva added enhancement New feature or request feat: theme and removed bug: pending triage Maybe a bug, waiting for confirmation labels Mar 8, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants