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

Search cannot be disable in navbar #9905

Closed
mcanouil opened this issue Jun 6, 2024 · 3 comments · Fixed by #11339
Closed

Search cannot be disable in navbar #9905

mcanouil opened this issue Jun 6, 2024 · 3 comments · Fixed by #11339
Assignees
Labels
bug Something isn't working search websites Issues creating websites
Milestone

Comments

@mcanouil
Copy link
Collaborator

mcanouil commented Jun 6, 2024

It's not possible to disable the search button/bar when in its default location, namely navbar.

The search will still appear on the right of the navbar.

website:
  search: 
    location: navbar
  navbar:
    search: false

As a comparison, the same for sidebar works as expected:

website:
  search: 
    location: sidebar
  sidebar:
    search: false

Originally posted by @mcanouil in #9836 (comment)

@mcanouil mcanouil added bug Something isn't working websites Issues creating websites search labels Jun 6, 2024
@cderv
Copy link
Collaborator

cderv commented Jun 6, 2024

So the aim is to control the search box inclusion at the navbar or sidebar level and not at the top level website.search ?

This is the issue here, is this correct understanding ?

@mcanouil
Copy link
Collaborator Author

mcanouil commented Jun 6, 2024

Possibly, at least the documentation implies that it is possible. If you cannot disable at the navbar level, then it's odd to have search: true (if it can take true, I expect false to be valid) and the below description in the documentation.

Include a search box (true or false). Note that if there is already a search box on the top navigation bar it won’t be displayed on the sidebar.

Source: https://quarto.org/docs/websites/website-navigation.html#side-navigation

The main issue to me is that if you want to disable search, from the documentation, it is very likely, a user will try:

website:
  navbar:
    search: false

@cderv
Copy link
Collaborator

cderv commented Jun 6, 2024

It seems there is indeed a difference in processing

For sidebar

const searchOpts = searchOptions(project);
sidebar.search = sidebar.search !== undefined
? sidebar.search
: searchOpts && searchOpts.location === "sidebar"
? searchOpts.type
: false;

for navbar

const searchOpts = searchOptions(project);
const data: Navbar = {
...navbar,
search: searchOpts && searchOpts.location === "navbar"
? searchOpts.type
: false,

So in the former, if sidebar.search is set to false, it deactive search , and global setting is ignored
For the latter, the value of navbar.search does not seem important at all.

I believe it has been lost here: 0b86f22#diff-2399e32434824d82d99e49170925185608bab491654180e0426afae839d61ef0L764

Previously, the navbar.search was the way to activate it, before the website.search.location was implemented.

And the exact same issue has been fixed for sidebar.search in there: 0ba4ad1

So probably we should do the same for navbar.

@cderv cderv self-assigned this Jun 6, 2024
@cderv cderv added this to the v1.5 milestone Jun 6, 2024
@cscheid cscheid modified the milestones: v1.5, v1.6 Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working search websites Issues creating websites
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants