Skip to content

[Search] Close the search when opening an element from a full path tag - #4071

Open
sholzer wants to merge 9 commits into
2026.2from
1879-search-full-path-opens-wrong-element
Open

[Search] Close the search when opening an element from a full path tag#4071
sholzer wants to merge 9 commits into
2026.2from
1879-search-full-path-opens-wrong-element

Conversation

@sholzer

@sholzer sholzer commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Changes in this pull request

Resolves #1879

Clicking the full path in a search result opened the element but left the search modal in front of it, so the element appeared to open in the background. A double click then also hit the grid's row handler, which is what closed the modal.

ElementTag's own onClick called openElement without letting the surrounding UI react, while every sibling open path — the three open-element decorators and the general tab's result item — pairs openElement with close(). The fix covers all three typed tabs (Documents, Assets, Data Objects) plus any other element tag rendered inside the modal.

ElementTag is exported from the SDK, so it does not reference the search module. It fires onElementClick() from a feature-neutral ElementClickBehaviorContext that defaults to a no-op, and the three search listings supply close() as that callback — keeping the close logic in the search listing layer, next to the OpenElementDecorator that already closes the search on row double click. The callback fires after the awaited openElement().

Additional info

Steps to reproduce

  • Open the search, switch to Data Objects, search for a term
  • Click the full path in a result row
  • Before: the object opens behind the still-open modal; a double click was needed to close it
  • After: the object opens and the search closes on a single click

Verified

  • npx eslint on both changed directories — clean
  • npx tsc --noEmit — clean
  • Existing frontend suite — 57 suites / 417 tests pass

🤖 Generated with Claude Code

sholzer and others added 3 commits September 2, 2026 14:21
The full path cell in the search modal's typed tabs opened the element
but left the modal in front of it, so the element appeared to open in
the background. A double click then hit the grid's row handler as well,
which is what closed the modal.

ElementTag's own onClick called openElement without closing the search,
while every sibling open path — the three open-element decorators and
the general tab's result item — pairs openElement with close(). Fixing
it in ElementTag covers all three typed tabs plus any other element tag
rendered inside the modal.

ElementTag is a generic SDK component rendered both inside and outside
the search, and SearchProvider only wraps the left sidebar slot, so
useSearch() would throw wherever no provider is above. Added
useSearchOptional() for that case; useSearch() keeps throwing for the
call sites that require a provider.

Fixes #1879.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The SDK component now depends on search-specific business logic, violating the component/module boundary.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates element-tag interactions to close an active search before opening an element.

Changes:

  • Adds an optional search-context hook.
  • Closes search when an ElementTag opens an element.
File summaries
File Description
use-search.ts Adds optional context access.
element-tag.tsx Closes an enclosing search on click.
Review details
  • Files reviewed: 2/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread assets/js/src/core/components/element-tag/element-tag.tsx Outdated
Comment thread assets/js/src/core/modules/search/provider/use-search.ts Outdated
Addresses the review: ElementTag is an SDK-exported component, so
importing the search module from it reversed the components/modules
dependency boundary.

ElementTag now calls onElementOpen() from a feature-neutral
ElementOpenBehaviorContext, which defaults to a no-op, and knows nothing
about the search. The three search listings supply close() as that
callback, so the close logic sits in the search listing layer next to
the OpenElementDecorator that already closes the search on row double
click.

Reverts useSearchOptional(), which is no longer needed.

Co-Authored-By: Claude <noreply@anthropic.com>
@sholzer
sholzer requested a balanced review from Copilot September 2, 2026 12:57
@sholzer sholzer added this to the 2026.2.9 milestone Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The scoped context integration consistently fixes single-click navigation without changing behavior outside search listings.

Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

sholzer and others added 2 commits September 2, 2026 13:00
Renames ElementOpenBehavior to ElementClickBehavior throughout, and
moves the callback to after the awaited openElement() call.

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The modal-close callback currently waits for the element-opening network request to finish.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread assets/js/src/core/components/element-tag/element-tag.tsx Outdated
sholzer and others added 2 commits September 2, 2026 13:13
Closes the search on the click itself rather than after the two
sequential requests openElement performs, so the single click dismisses
the modal immediately.

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused context-based change consistently resolves the modal behavior without introducing unresolved issues.

Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@sholzer
sholzer requested a review from xIrusux September 2, 2026 13:43
@sholzer
sholzer marked this pull request as ready for review September 2, 2026 13:43
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@xIrusux xIrusux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

More of an idea to check out to keep topics close together rather than a definite change request :)

Not so long ago I implemented select & close on doubleclick (for lisist in many to many relation fields)

Thats why I am thinking the tag click could live alongside it in the OpenElementDecorator

i.e.
They could both live in OpenElementDecorator. Decorators can wrap the ContextComponentslot with a provider, the same waywithRowSelectionContextorwithPagingContextdo. So next towith-open-element-event.tsthere could be awith-open-element-context.tsx`:

export const withOpenElementContext = (Component: AbstractDecoratorProps['ContextComponent']): AbstractDecoratorProps['ContextComponent'] => {
  const OpenElementContextComponent: AbstractDecoratorProps['ContextComponent'] = () => {
    const { close } = useSearch()

    return (
      <ElementClickBehaviorProvider onElementClick={ close }>
        <Component />
      </ElementClickBehaviorProvider>
    )
  }

  return OpenElementContextComponent
}`

That would mean:

- the three listing files stay untouched
- one decorator owns both "open from search" behaviours
- any listing that composes OpenElementDecorator gets the tag close for free

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.

[Search] clicking full path on data object search opens image in the background

3 participants