Skip to content

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Dec 19, 2025

After this change:

Scenario Behavior
Type search, click result Navigate without ?q=, clean URL without dropdown
Type search, press Enter Navigate without ?q=, clean URL without dropdown
Land on URL with ?q= param Show dropdown with pre-filled query
Click outside dropdown Hide dropdown, keep input value
Focus input with existing query Show dropdown again

@st0012 st0012 added the bug label Dec 19, 2025
@matzbot
Copy link
Collaborator

matzbot commented Dec 19, 2025

🚀 Preview deployment available at: https://3aedfc70.rdoc-6cd.pages.dev (commit: d461adf)

@st0012 st0012 changed the title Hide desktop search dropdown when clicking outside Fix search dropdown behaviour Dec 19, 2025
// Hide search results when clicking outside the search area
document.addEventListener('click', (e) => {
if (!e.target.closest('.navbar-search-desktop')) {
result.setAttribute('aria-expanded', 'false');
Copy link
Member

Choose a reason for hiding this comment

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

Up and down arrow keys still moves in the hidden search navigation.
I think search.setNavigationActive(false) search.setNavigationActive(true) are needed where changing aria-expanded attribute.

Adding search.hide() and search.show() that does both might be a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah good catch. Updated 👍

# RDoc version you are using

VERSION = '7.0.1'
VERSION = '7.0.2'
Copy link
Member

Choose a reason for hiding this comment

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

Maybe wrong commit pushed?
I'm fine cutting 7.0.2

Copy link
Member Author

Choose a reason for hiding this comment

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

No I just thought if we could merge the PR we can ship it immediately in 7.0.2 😛
This would still work tho. I'd love to cut a new release right after this is merged.

Copy link
Member

Choose a reason for hiding this comment

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

I see 👍

After this change:

| Scenario | Behavior |
|----------|----------|
| Type search, click result | Navigate without `?q=`, clean URL without dropdown |
| Type search, press Enter | Navigate without `?q=`, clean URL without dropdown |
| Land on URL with `?q=` param | Show dropdown with pre-filled query |
| Click outside dropdown | Hide dropdown, keep input value |
| Focus input with existing query | Show dropdown again |
Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

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

👍

@st0012 st0012 merged commit fe2fe63 into master Dec 22, 2025
62 checks passed
@st0012 st0012 deleted the fix-search-modal branch December 22, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants