#110482selectTree filter throws on regular expression meta characters
Description
The search field of a TCA selectTree passes the typed value straight into the
@RegExp@ constructor without escaping it:
// Build/Sources/TypeScript/backend/form-engine/element/select-tree.ts
public override filter(searchTerm?: string|null): void {
...
const regex = new RegExp(searchTerm, 'i');
The value is user input, taken directly from the search field:
// Build/Sources/TypeScript/backend/form-engine/element/select-tree-toolbar.ts
<input type="search" ... @input="${(evt: InputEvent) => this.filter(evt)}">
...
private filter(event: InputEvent): void {
const inputEl = <HTMLInputElement>event.target;
this.tree.filter(inputEl.value.trim());
}
How to reproduce
- Open a record with a TCA field using
renderType = selectTree, for example the
category tree of a content element - Type an opening bracket into the “Find item” search field
Result
new RegExp('(', 'i') throws a SyntaxError, the input handler dies and the filter
silently stops working. Entering an ordinary title such as “Müller & Söhne (GmbH)” is
enough to trigger it.
Expected
The search term is treated as literal text, as everywhere else.
Notes
This is the same defect that #107565 fixed for
@form-engine/element/extra/select-box-filter.ts@ – the selectTree filter was not
touched back then.
Since the search term is escaped to a literal anyway, the RegExp can be dropped in
favour of String.includes() on a normalized string, which also removes the need for the
escaping in the first place. That is the same direction proposed for #83788, which asks
for accent insensitive filtering in the side by side select. Fixing both filters the same
way would make them behave consistently.
Reviews 2
History 25
-
Gerrit Code Review pushed patch set 1 for main to change 95326 status
NewUnder Review <span data-processor="relativetime" data-value="2026-08-13T19:25:21+00:00" > 08/13/26, 19:25 </span> -
Gerrit Code Review pushed patch set 2 for main to change 95326 <span data-processor="relativetime" data-value="2026-08-14T22:24:25+00:00" > 08/14/26, 22:24 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 95473 <span data-processor="relativetime" data-value="2026-08-28T09:24:51+00:00" > 08/28/26, 09:24 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-08-28T09:40:11+00:00" > 08/28/26, 09:40 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-09-08T10:03:17+00:00" > 09/08/26, 10:03 </span>
Applied in changeset commit:06206a8ae69c47f11aa93a1ff0ca4d720205c396.