Skip to content

fix: select placeholder title text when rename field opens#29

Merged
Waleed-Mujahid merged 3 commits into
develop-ulmofrom
fix/select-title-on-rename-focus
Jul 21, 2026
Merged

fix: select placeholder title text when rename field opens#29
Waleed-Mujahid merged 3 commits into
develop-ulmofrom
fix/select-title-on-rename-focus

Conversation

@ZamanChaudhary

@ZamanChaudhary ZamanChaudhary commented Jul 15, 2026

Copy link
Copy Markdown

Problem

Screenshot 2026-07-15 at 1 56 04 PM

Summary

  • Course builders had to manually highlight and delete the default
    "Section"/"Subsection"/"Unit" placeholder before renaming a new item
    — this worked automatically on the old Backbone Studio outline but
    was dropped when the outline moved to this MFE.
  • Implemented as a standalone focusin listener
    (generic/select-title-on-focus.js, initialized once from
    index.jsx) rather than editing the rename fields in
    CardHeader.tsx / HeaderTitle.jsx directly, so those
    upstream-tracked components stay untouched and this change won't
    conflict with future merges from openedx/frontend-app-authoring.
  • The listener watches for focus on any element matching
    [data-testid$="-edit-field"] (Section/Subsection/Unit cards in
    the outline tree) or [data-testid="unit-header-title"] input
    (standalone Unit page title) and selects the full text.

Test plan

  • New generic/select-title-on-focus.test.js: verifies each field
    type gets selected on focus, unrelated inputs are untouched, and
    the listener isn't double-attached.
  • npm test — 44/44 tests pass.
  • Manually verified in a Tutor dev devstack: creating/renaming a
    Section, Subsection, and Unit now highlights the title on open.

Section/Subsection/Unit renaming (outline tree and the standalone Unit
page) focused the rename field but never selected its text, so builders
had to manually clear the "Section"/"Subsection"/"Unit" placeholder
before typing. Add select-on-focus so the whole title is highlighted
and ready to be typed over, matching the old Backbone Studio behavior
(xblock_string_field_editor.js's `input.focus().select()`).
Replace the direct edits to CardHeader.tsx and HeaderTitle.jsx with a
standalone focusin listener (generic/select-title-on-focus.js),
wired up once from index.jsx. This keeps the two rename-field
components byte-identical to openedx/frontend-app-authoring, so
future upstream merges don't conflict on this change.

@Waleed-Mujahid Waleed-Mujahid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Replace the direct edits to CardHeader.tsx and HeaderTitle.jsx with a
standalone focusin listener (generic/select-title-on-focus.js),
wired up once from index.jsx. This keeps the two rename-field
components byte-identical to openedx/frontend-app-authoring, so
future upstream merges don't conflict on this change.
@Waleed-Mujahid
Waleed-Mujahid merged commit 9eab4d0 into develop-ulmo Jul 21, 2026
3 of 4 checks passed
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.

2 participants