Skip to content

Bug 1986319: Auto-select for full hash matches#1066

Open
moijes12 wants to merge 2 commits into
mozilla:mainfrom
moijes12:bug1986319-latest
Open

Bug 1986319: Auto-select for full hash matches#1066
moijes12 wants to merge 2 commits into
mozilla:mainfrom
moijes12:bug1986319-latest

Conversation

@moijes12

@moijes12 moijes12 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Overview

Automatically select a single matching revision from search results (partial or full hash), and keep the autocomplete dropdown open when a full 40-char hash is pasted. Also reopen the dropdown when a selected revision is removed. Adds tests and updates snapshots.

Changes Introduced

  • When an exact 40-character hash is entered/pasted, the autocomplete dropdown is kept open so users can see matching options.
  • Reopens the dropdown if a previously selected revision is removed.
  • Introduces component state and refs to track dropdown open state and to avoid stale closures.
  • Adds unit tests (src/tests/Search/SearchAutoSelect.test.tsx) and updates many snapshots to reflect the new open/close behavior.

Files Modified

  • src/components/Search/SearchInputAndResults.tsx : added isDropdownOpen state, refs, effects, and open/onOpen/onClose handlers; updated input/change handlers and selection logic.
  • src/tests/Search/SearchAutoSelect.test.tsx : tests for auto-selection and dropdown behavior.
  • Updated: multiple snapshot files

Testing

  • Unit tests added:
  • Ensure CI passes and review updated snapshots.
  • Manually tested by typing partial hash, paste full 40-char hash, selecting/removing revisions and confirming dropdown behavior matches expectations.

Fixes Bug-1986319

@kala-moz @beatrice-acasandrei

moijes12 added 2 commits July 7, 2026 13:31
- Automatically select a revision when a full 40-character hash or a partial hex hash (length >= 4) matches exactly one result or matches a result's revision hash.
- Ensure the revision dropdown remains open after auto-selecting a full 40-character hash.
- Automatically open the revision dropdown when a selected revision is removed from the view.
- Added a new test suite `src/__tests__/Search/SearchAutoSelect.test.tsx` to verify these behaviors.
- Updated existing snapshots in `src/__tests__/Search/__snapshots__`.
@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for mozilla-perfcompare ready!

Name Link
🔨 Latest commit 9fce1d5
🔍 Latest deploy log https://app.netlify.com/projects/mozilla-perfcompare/deploys/6a4d0d7a5e06740008a6b5cd
😎 Deploy Preview https://deploy-preview-1066--mozilla-perfcompare.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@moijes12 moijes12 changed the title Bug 1986319: Auto-select single search result and keep dropdown open for full hashes Bug 1986319: Auto-select for full hash matches Jul 10, 2026
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.

1 participant