Skip to content

Conversation

@Ruthwik000
Copy link

@Ruthwik000 Ruthwik000 commented Dec 12, 2025

Add 'No results found' feedback for empty search results

✅ Solution

This PR implements a "No results found" feedback message that appears when search queries return no matching blocks.

Changes Made

Modified File: js/activity.js

1. Enhanced doSearch() function

  • Added response handler to jQuery autocomplete
  • Detects when search returns empty results (ui.content.length === 0)
  • Injects a "No results found" message into the results
  • Message is marked with isNoResult: true flag for special rendering

2. Enhanced doHelpfulSearch() function

  • Applied the same fix to the helpful search widget (accessed via helpful wheel menu)
  • Ensures consistent behavior across both search interfaces

3. Custom Rendering

  • Modified _renderItem in both functions to handle the "No results found" message
  • Special styling for the message:
    • Centered text with padding
    • Gray color with italic font style
    • Light background (#f9f9f9)
    • Non-interactive (pointer-events: none)
    • Cannot be selected or clicked

Key Features

Visual Feedback: Shows "No results found" instead of empty dropdown
Non-interactive: Message has pointer-events: none so users can't click it
Styled Appropriately: Gray, italic text on light background to indicate it's informational
Internationalized: Uses _("No results found") for translation support
Maintains Dropdown: The dropdown stays visible with the message instead of disappearing
Consistent UX: Applied to both main search and helpful search widgets

🧪 Testing

Manual Testing Steps

  1. Start Music Blocks development server
  2. Open the application in a browser
  3. Click the search icon (magnifying glass)
  4. Type a non-existent block name like "zzzznonexistent"
  5. Verify "No results found" message appears in the dropdown
  6. Verify the message is styled correctly (gray, italic, centered)
  7. Verify you cannot click or interact with the message
  8. Test the helpful search widget (from helpful wheel menu) similarly

Test Cases Covered

  • ✅ Empty search results display message
  • ✅ Message is non-interactive
  • ✅ Message is properly styled
  • ✅ Works in both search widgets
  • ✅ Internationalization support ready

📸 Screenshots

Before

![Before - Empty dropdown disappears]
image
Search dropdown disappears with no feedback

After

![After - No results found message]
image
Clear "No results found" message displayed

🔍 Code Quality

  • ✅ Follows existing code style and conventions
  • ✅ Uses jQuery patterns consistent with codebase
  • ✅ Maintains backward compatibility
  • ✅ No breaking changes
  • ✅ Internationalization ready with _() function
  • ✅ Minimal code changes (focused fix)

📝 Additional Notes

  • This fix improves user experience by providing clear feedback
  • The implementation uses jQuery autocomplete's built-in response event
  • The solution is lightweight and doesn't require additional dependencies
  • Both search interfaces (main and helpful) are updated for consistency

🔗 Related Issues

Fixes: #4841 issue(search): Add 'No results found' feedback for empty search results

✨ Impact

This enhancement improves the user experience for Music Blocks users, especially beginners who may be confused when search results disappear without explanation. It provides clear, immediate feedback that helps users understand when their search query doesn't match any available blocks.

- Added response handler to jQuery autocomplete in doSearch()
- Added response handler to doHelpfulSearch() for consistency
- Display 'No results found' message when search returns empty
- Message is styled as non-interactive with gray italic text
- Maintains dropdown visibility instead of disappearing
- Supports internationalization with _() function

Fixes issue where searching for non-existent blocks showed no feedback
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Ruthwik000
Copy link
Author

Ruthwik000 commented Dec 12, 2025

hi maintainers !!
@zealot-zew @chimosky @therealharshit @FirePheonix

kindly review the PR description and check the PR , This enhancement improves the user experience for Music Blocks users ,Hope you find it useful
I'm ready to address any feedback or make any adjustments you might suggest. Please let me know if you have any questions about the changes .

Thankyou.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

Copy link
Contributor

@zealot-zew zealot-zew left a comment

Choose a reason for hiding this comment

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

Works good.
image

@FirePheonix
Copy link
Contributor

i like this change, what do you think @omsuneri ?

@walterbender
Copy link
Member

Why the special message rendering? Not sure this PR is solving a real issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue(search): Add 'No results found' feedback for empty search results

4 participants