Skip to content

Plugins → Exported Packages: search field loses focus to the package textarea while typing #36214

Description

@Neehakethi

Problem Statement

In the new (Angular) Plugins → Exported Packages screen, the search field automatically moves focus to the editable package-list <textarea> shortly after the user types. Because focus silently leaves the search input, any subsequent keystrokes are entered into the package list instead of the search box — the user can unintentionally modify the exported-packages configuration without realizing it.

Impact: reported by a customer on dotEvergreen. Functionally low severity, but there is a data-integrity angle — the textarea is the live exported-packages config, and unnoticed edits can corrupt it (a malformed exported-packages list is a known cause of OSGi plugin-load failures).

Root cause (identified): in libs/portlets/dot-plugins/src/lib/dot-plugins-extra-packages/dot-plugins-extra-packages.component.ts, typing fires onSearchChange() → a 500ms debounce (SEARCH_DEBOUNCE_MS) → #scrollToMatch(0), which calls textarea.focus() before setSelectionRange() (~lines 184–195). The .focus() is needed for the explicit ▲/▼ next/prev navigation but should not run on the search-as-you-type path.

Browser & OS: Not yet confirmed with the customer. Reproduced in a Chromium-based Jest/jsdom component-test environment.

Steps to Reproduce

  1. Log into the dotCMS admin.
  2. Open Plugins (the new Angular portlet) and click Exported Packages.
  3. Click into the search field at the top of the dialog.
  4. Type a few characters that match text in the package list (e.g. com).
  5. Pause briefly (~0.5s) after typing.

Actual: ~500ms after typing (the search debounce), focus jumps from the search input to the editable package-list textarea; further keystrokes edit the package list.
Expected: Focus stays in the search input; the match is scrolled into view/highlighted, but the caret remains in the search box.

Reproduced deterministically with a Spectator/Jest component test on portlets-dot-plugins-portlet: after typing and advancing the 500ms debounce with fakeAsync/tick, document.activeElement changes from the search <input> to the <textarea>; before the debounce fires it correctly remains in the input.

Acceptance Criteria

  • Typing in the Exported Packages search field does not move focus out of the search input
  • The matched text is still scrolled into view / highlighted while typing
  • Focus moves to the textarea only on explicit ▲/▼ (next/prev) match navigation
  • A regression test covers the search-as-you-type focus behavior

dotCMS Version

26.06.15-01
Current Release / dotEvergreen (Cloud). Search feature present since ~2026-04-14 (PR #35311; portlet migrated to Angular in PR #34957 / #34732). Not present in the legacy "Plugins Legacy" (Dojo) OSGi screen.

Severity

Low - Minor issue or cosmetic

Links

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

Status
In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions