Skip to content

Conversation

@leekelleher
Copy link
Member

Description

Resolves #20588.

When a Block item has a label which is rendered empty (e.g. a UFM label that exclusively uses a property value), the leading fragment of the browser's title is empty, (e.g. it would display as | Content | Umbraco, see #20588 for details).

To note, if the Block item has a label which has a value (isn't empty), then that will display in the browser's title.

This PR looks to add a prefix to the Block workspace's label, with either "Add" or "Edit" (depending on the isNew state). This way, if the Block item's label is empty, the prefix will still be used. (To note, these prefixes use localization keys, e.g. general_add, general_edit).

How to test?

With either a Block Grid or Block List editor, try adding a new block item, notice that the modal workspace headline and browser title is prefixed with "Add". Try editing an existing block item, notice that the modal workspace headline and browser title is now prefixed with "Edit".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds prefixes ("Add" or "Edit") to block workspace titles to prevent empty browser titles when a block item has an empty label (e.g., when using a UFM label that exclusively references a property value that's not yet set).

  • Moved the workspace title generation logic from block-workspace-editor.element.ts to block-workspace.context.ts
  • Enhanced the #renderLabel method to include settings values and generate prefixed titles based on the block's isNew state
  • Simplified the block-workspace-editor.element.ts to observe and display the already-formatted name

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-workspace.context.ts Adds logic to prefix workspace titles with "Add" or "Edit" based on isNew state; includes settings values in label rendering and generates titles with localization key prefixes
src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-workspace-editor.element.ts Simplifies headline generation by removing the localization logic and observing the pre-formatted name from context; removes unused imports

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty part in browser title when block is opened

2 participants