Skip to content

[2.x] fix: handle null gotoItem in SearchModal selectResult to prevent cras…#4376

Merged
imorland merged 2 commits into2.xfrom
im/fix-admin-search-enter-key
Feb 21, 2026
Merged

[2.x] fix: handle null gotoItem in SearchModal selectResult to prevent cras…#4376
imorland merged 2 commits into2.xfrom
im/fix-admin-search-enter-key

Conversation

@imorland
Copy link
Copy Markdown
Member

…h on Enter key

When a search source (e.g. GeneralSearchSource in admin) sets data-id on results but returns null from gotoItem(), selectResult() would fall through to item.find('button')[0].click() — crashing when the item contains a link () rather than a button.

Fix by consolidating the link-fallback check to run whenever selectedUrl is still null, and guarding the button click with a length check.

Fixes #4281

**Fixes #4281 **

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

Loading
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.

[2.x] Cannot navigate admin search modal with enter

1 participant