Skip to content

[Translations] Fix: search & field filters in Translations sidebar don't trigger on Enter/search icon - #4012

Open
albertmueller wants to merge 7 commits into
pimcore:2026.2from
albertmueller:fix/translations-sidebar-search-trigger
Open

[Translations] Fix: search & field filters in Translations sidebar don't trigger on Enter/search icon#4012
albertmueller wants to merge 7 commits into
pimcore:2026.2from
albertmueller:fix/translations-sidebar-search-trigger

Conversation

@albertmueller

Copy link
Copy Markdown
Contributor

Summary

  • The top search field in the Translations "Search & Filter" sidebar only wrote the typed value into a draft store on change; clicking the search icon or pressing Enter (which antd's Input.Search reports via onSearch, not onChange) did nothing. Fixed by wiring onSearch to apply the term immediately.
  • Field filters (e.g. the "German" text column) used a plain Input with no search icon, only committing on blur into the draft store — the value was lost unless "Apply" was clicked afterwards. Fixed by switching to SearchInput, adding an optional onCommit callback threaded through
    DynamicFilterProvider → FieldFilters → the translations field-filter hook, so Enter/search-icon immediately applies the filter, and stretched the input to full sidebar width.

Changes

  • filters/filters.tsx: search term control now applies on onSearch, not just onChange.
  • components/dynamic-filter/provider/dynamic-filter-provider.tsx: added commit()/onCommit alongside the existing setData()/onChange.
  • components/field-filters/field-filters.tsx: added an onCommit prop, mirroring the existing onChange handling.
  • dynamic-type-field-filter-text-component.tsx: switched from Input to SearchInput, wired onSearch to commit(), set full width.
  • translations/filters/hooks/use-translations-field-filter-editor.ts: added onFilterCommit, which writes the committed field filter directly into both the draft and applied filter stores.
  • translations-sidebar/components/filter-tab/filter-tab.tsx: wired the new onCommit handler into FieldFilters.

Fixed state:
image

Fixes pimcore/platform-version#354
The issue was also reported as an enterprise issue: PEES-1392

albertmueller and others added 3 commits August 21, 2026 09:02
SearchTermControl only wired onChange, but antd's Input.Search fires
onSearch (not onChange) for the search icon click and the Enter key.
As a result, the search & filter sidebar required using the "Apply"
button, silently ignoring the search icon and Enter key.

Add an onSearch handler that applies the term immediately, mirroring
the working element listing's SearchTermFilter.
Text field filters (e.g. the "German" column) only wrote into the
sidebar's draft store on blur, so a value typed there was silently
dropped unless the user also clicked the separate "Apply" button.

Give the field-filter dynamic type a search input and thread an
optional onCommit callback through DynamicFilterProvider and
FieldFilters so a committed value (Enter or the search icon) is
written straight to the applied filter store, matching the existing
"Apply" button behavior. Also stretch the input to the full sidebar
width to match the main search field.
Copilot AI balanced review requested due to automatic review settings August 21, 2026 08:12

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.

Pull request overview

Enables immediate submission of translation search and text field filters via Enter or the search icon.

Changes:

  • Adds commit handling across dynamic and field-filter components.
  • Uses SearchInput for text field filters.
  • Applies committed translation filters immediately.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
filter-tab.tsx Connects field-filter commits.
use-translations-field-filter-editor.ts Synchronizes committed field filters.
filters.tsx Handles top-level search submission.
dynamic-type-field-filter-text-component.tsx Adds searchable text-filter input.
field-filters.tsx Propagates filter commits.
dynamic-filter-provider.tsx Adds commit support to filter context.

💡 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/modules/translations/filters/filters.tsx
Committing the search term or a field filter only wrote that single
key into the applied filter store, so any other still-unsaved draft
change (e.g. a field filter typed but not yet applied) was silently
dropped instead of being applied together, unlike clicking "Apply"
which applies the entire draft snapshot at once.

Apply the full current draft values on commit, overriding just the
field being committed to avoid reading a stale React state value for
it.

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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (1)

assets/js/src/core/modules/element/dynamic-types/definitions/field-filters/components/dynamic-type-field-filter-text-component.tsx:32

  • Use the searchValue supplied by SearchInput here. The clear control invokes onSearch with an empty value in the same event as onChange, before _value has re-rendered, so this closure can recommit the previous text and leave the filter applied instead of clearing it.
      onSearch={ () => { commit(_value) } }

…state

The field filter's SearchInput read the committed value from local
component state (_value) rather than the value onSearch itself
received. Clicking the clear (x) icon fires onChange('') and
onSearch('') in the same event before the state update from onChange
has re-rendered, so the stale closure could recommit the previous
text and leave the filter applied instead of clearing it.

Commit the value passed into onSearch directly to avoid the race.

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.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (2)

assets/js/src/core/components/field-filters/field-filters.tsx:67

  • This newly added direct undefined comparison bypasses the project's type-safe check convention. Invoke the optional callback directly (or use isUndefined) so this branch follows the required nullability pattern.
    if (onCommit !== undefined) {
      onCommit(updatedData)
    }

assets/js/src/core/components/dynamic-filter/provider/dynamic-filter-provider.tsx:65

  • This newly added direct undefined comparison bypasses the project's type-safe check convention. Invoke the optional callback directly (or use isUndefined) so this branch follows the required nullability pattern.
    if (onCommit !== undefined) {
      onCommit(data)
    }

@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants