Skip to content

Focus the title of a new or copied section, and of a copied site - #672

Merged
uldisrudzitis merged 1 commit into
masterfrom
focus-new-section-and-site-titles
Oct 29, 2026
Merged

uldisrudzitis merged 1 commit into
masterfrom
focus-new-section-and-site-titles

Conversation

@uldisrudzitis

@uldisrudzitis uldisrudzitis commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

After creating or copying a section, or copying a site, the editor puts the cursor straight into the new item's title. You no longer have to find it at the bottom of the list and click its edit icon.

What changes for editors

  • Create new section / copy section: the editor goes to /sections/<name>?section=<name>. That opens the section's settings and loads its page in the preview. The title input is focused and scrolled into view.
  • Copy site: the editor switches to the copy (?site=<name>), scrolls to it and focuses its title. "Create new site" still opens the setup wizard.
  • Placeholders: empty section and site titles show "Section title" / "Site title". They also show after the text is cleared.

Notes for review

  • /sections and /sections/:section are separate routes, so opening a new section from /sections replaces SiteSectionsComponent. The router starts the new instance only after the navigation has finished, so the navigation's state is no longer available to it. Instead, the section to focus is kept in a static field and only used when the shown section matches it, so a reload or the back button doesn't refocus.
  • CloneSectionAction now returns its dispatch. Before, its observable completed before the copy was in the store.
  • Clone handling moved from SectionComponent / SiteComponent up to the lists. The rows emit clone, as they already emit update for edits. SitesComponent.addSite() is shared by create and clone.

Tests

  • inline-text-input.component.spec.ts: placeholder text and startEditing().
  • site-sections.component.spec.ts: create from /sections and copy from /sections/home, with the real router. It checks the URL and the focused title input. The create case fails without the fix.
  • sites.component.spec.ts: copy site, URL and focus.
  • npx ng test --watch=false --browsers=ChromeHeadless: 197 pass. npm run build passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Empty site and section titles now display helpful placeholders, with a subtle visual distinction from entered text.
    • Creating or copying a site or section now opens the new item and focuses its title field, ready for editing.
    • Site and section title fields can be focused and brought into view for editing.

…ed site

- "Create new section" and a section's "copy" open the new section (/sections/<name>?section=<name>): its settings, its page in the preview, and its title input focused and scrolled into view. Going from /sections to /sections/:section replaces the sections list, so the section to focus is kept on the component class.
- A site's "copy" switches to the copy and focuses its title. "Create new site" still opens the setup wizard.
- Empty section and site titles show a "Section title" / "Site title" placeholder, also after the text is cleared.
- CloneSectionAction returns its dispatch, so the copy is in the store when the action completes.
- Tests: inline text input placeholder and startEditing(), section create/copy and site copy navigation and focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5258b96-8b0d-4601-a9cb-8038083a7c40
Commits

Reviewing files that changed from the base of the PR and between 1ed1c9e and 27ee317.

Files selected for processing: 9
  • editor/src/app/inputs/inline-text-input.component.spec.ts
  • editor/src/app/inputs/inline-text-input.component.ts
  • editor/src/app/sites/sections/section.component.ts
  • editor/src/app/sites/sections/sections-state/site-sections.state.ts
  • editor/src/app/sites/sections/site-sections.component.spec.ts
  • editor/src/app/sites/sections/site-sections.component.ts
  • editor/src/app/sites/site.component.ts
  • editor/src/app/sites/sites.component.spec.ts
  • editor/src/app/sites/sites.component.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

Inline title inputs now support placeholders and programmatic editing. Site and section creation or cloning navigates to the new item and focuses its title input.

Changes: Create, clone, and focus titles

Layer / File(s) Summary
Inline title input behavior
editor/src/app/inputs/inline-text-input.component.ts, editor/src/app/inputs/inline-text-input.component.spec.ts
The input displays its value, placeholder, or .... It exposes startEditing() and applies an is-empty class when the value is falsy. Tests cover display and focus behavior.
Site creation, cloning, and title focus
editor/src/app/sites/site.component.ts, editor/src/app/sites/sites.component.ts, editor/src/app/sites/sites.component.spec.ts
Site components emit clone events. SitesComponent identifies the new site after dispatch, navigates to it, and focuses its title input. Creation uses the same new-site lookup and navigation flow.
Section creation, cloning, and title focus
editor/src/app/sites/sections/section.component.ts, editor/src/app/sites/sections/site-sections.component.ts, editor/src/app/sites/sections/sections-state/site-sections.state.ts, editor/src/app/sites/sections/site-sections.component.spec.ts
Section components emit clone events. SiteSectionsComponent opens the created or cloned section and focuses its title input. cloneSection returns the action dispatch result.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant SiteComponent
  participant SitesComponent
  participant NGXSStore
  participant Router
  participant InlineTextInputComponent
  User->>SiteComponent: Click copy
  SiteComponent->>SitesComponent: Emit clone event with site model
  SitesComponent->>NGXSStore: Dispatch clone action and read updated sites
  NGXSStore-->>SitesComponent: Return newly added site
  SitesComponent->>Router: Navigate to new site
  SitesComponent->>SiteComponent: Focus title after navigation and render
  SiteComponent->>InlineTextInputComponent: Start title editing
Loading

Suggested reviewers: blackwolfie, vteivans

Merge Risk: Minimal · up to 27ee3

No new issue requiring a fix before merge was established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main behavior change: a new or copied section, and a copied site, now get their title focused. The changeset adds section and site title focus after creation or copy, and moves clo…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main behavior change: a new or copied section, and a copied site, now get their title focused. The changeset adds section and site title focus after creation or copy, and moves clone handling into the list components, so the title matches the primary change. It does not mention the placeholder and startEditing() additions, which is acceptable because the title does not need to cover every detail.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 9 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@uldisrudzitis
uldisrudzitis merged commit 5600a6e into master Oct 29, 2026
7 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.

1 participant