Skip to content

fix(plugins): keep focus on search input in Exported Packages (#36214)#36300

Open
hmoreras wants to merge 3 commits into
mainfrom
issue-36214-plugins-fix
Open

fix(plugins): keep focus on search input in Exported Packages (#36214)#36300
hmoreras wants to merge 3 commits into
mainfrom
issue-36214-plugins-fix

Conversation

@hmoreras

@hmoreras hmoreras commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

  • The Plugins → Exported Packages search field was silently moving focus to the editable package-list <textarea> ~500 ms after typing (the debounce). Any keystrokes after the debounce fired went into the textarea instead of the search box — and the textarea is the live exported-packages config, so unnoticed edits can corrupt it (a known cause of OSGi plugin-load failures).
  • #scrollToMatch() in dot-plugins-extra-packages.component.ts was calling textarea.focus() unconditionally. That call is needed for the explicit ▲/▼ next/prev navigation but not for the search-as-you-type path.
  • This PR adds an opt-in { focus } flag to #scrollToMatch. The debounced typing path now leaves focus on the search input; only nextMatch() / prevMatch() pass focus: true. The selection range is still set during typing so the match becomes visible the moment the user navigates with ▲/▼.

Fixes #36214

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
  • Focus moves to the textarea only on explicit ▲/▼ (next/prev) match navigation
  • Regression tests cover the search-as-you-type focus behavior

Test plan

  • Manual QA: open Plugins → Exported Packages, type in the search box, confirm focus stays in the input and that ▲/▼ still navigates and selects matches in the textarea

…kages

The Exported Packages search field was moving focus to the editable
package-list textarea ~500ms after typing (the debounce). Subsequent
keystrokes silently edited the live exported-packages config — a
data-integrity risk since malformed lists break OSGi plugin loading.

`#scrollToMatch` now takes an opt-in `{ focus }` flag. The debounced
search-as-you-type path leaves focus on the search input; only the
explicit ▲/▼ navigation focuses the textarea so the match selection
becomes visible.

Fixes #36214

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Claude finished @hmoreras's task in 53s —— View job


Rollback Safety Analysis

  • Read rollback-unsafe categories reference
  • Get full PR diff
  • Analyze diff against unsafe categories
  • Apply appropriate label

Result: ✅ Safe To Rollback

The changes in this PR are pure frontend Angular fixes with no backend impact. Against every unsafe category in the reference:

Category Verdict
C-1 Structural Data Model Change ✅ Not applicable — no DB changes
C-2 Elasticsearch Mapping Change ✅ Not applicable — no ES changes
C-3 Content JSON Model Version Bump ✅ Not applicable
C-4 DROP TABLE / DROP COLUMN ✅ Not applicable
H-1 One-Way Data Migration ✅ Not applicable
H-2 RENAME TABLE / COLUMN ✅ Not applicable
H-3 PK Restructuring ✅ Not applicable
H-4 New Content Field Type ✅ Not applicable
H-5 Storage Provider Change ✅ Not applicable
H-6 DROP PROCEDURE / FUNCTION ✅ Not applicable
H-7 NOT NULL Column Without Default ✅ Not applicable
H-8 VTL Viewtool Contract Change ✅ Not applicable
M-1 Column Type Change ✅ Not applicable
M-2 Push Publishing Bundle Format ✅ Not applicable
M-3 REST / GraphQL API Contract ✅ Not applicable
M-4 OSGi Plugin API Breakage ✅ Not applicable

Changed files:

  • dot-plugins-extra-packages.component.ts — exports SEARCH_DEBOUNCE_MS constant, adds optional { focus } parameter to #scrollToMatch(), changes nextMatch()/prevMatch() to pass focus: true
  • dot-plugins-extra-packages.component.spec.ts — adds 5 regression tests for search focus behavior

All changes are scoped to a single Angular component's TypeScript and test file. No database migrations, Elasticsearch mappings, REST endpoints, OSGi interfaces, or VTL viewtools are touched. Rolling back to the previous release requires no database interaction or reindexing.

Label added: AI: Safe To Rollback

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🤖 Bedrock Review — us.deepseek.r1-v1:0

No issues found.


Run: #28064948717 · tokens: in: 2750 · out: 4518 · total: 7268

@github-actions github-actions Bot added the Area : Frontend PR changes Angular/TypeScript frontend code label Jun 23, 2026
- Export SEARCH_DEBOUNCE_MS from the component and import it in the spec
  so the debounce stays in sync between prod and tests.
- Mirror nativeTextarea()'s nullable pattern in searchInput() to surface a
  clear failure if the testid ever disappears.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🤖 Bedrock Review — us.deepseek.r1-v1:0

No issues found.


Run: #28065169081 · tokens: in: 3013 · out: 693 · total: 3706

Collapse PACKAGES_TEXT back to a single line — the string fits within
Prettier's print width, and the prior commit's wrap caused format-test
to fail in CI (run 28064948599).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🤖 Bedrock Review — qwen.qwen3-next-80b-a3b

#### New Issues
- 🟡 Medium: `core-web/libs/portlets/dot-plugins/src/lib/dot-plugins-extra-packages/dot-plugins-extra-packages.component.ts:189` — `textarea.focus()` is now conditional on `{ focus: true }`, but `#scrollToMatch` is called without `focus: true` in `searchInput$` debounced path; if this path was intended to preserve input focus, the logic is correct — but if the textarea should ever be focused during typing (e.g., for accessibility), this change silently breaks it. Assumption: The component's accessibility behavior (e.g., screen reader navigation) relies on textarea focus during search. What to verify: Does the textarea need to be focusable for keyboard/screen reader users during search-as-you-type? If yes, this is a regression.

#### Existing
- (none)

#### Resolved
- ✅ `core-web/libs/portlets/dot-plugins/src/lib/dot-plugins-extra-packages/dot-plugins-extra-packages.component.ts:35` — `SEARCH_DEBOUNCE_MS` was previously private; now exported for test use — this was intentional and required by the new tests.

<!-- dotcms-review-findings:[{"sev":"🟡 Medium","loc":"core-web/libs/portlets/dot-plugins/src/lib/dot-plugins-extra-packages/dot-plugins-extra-packages.component.ts:189","desc":"textarea.focus() is now conditional on { focus: true }, but called without it during search-as-you-type; may break accessibility if textarea needs focus during typing"}] -->

Run: #28071560708 · tokens: in: 2789 · out: 323 · total: 3112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

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

1 participant