Repository navigation
Keep the flag editor's browser tab title after modals close - #75
Merged
Merged
Conversation
Umbraco leaves the section's title (Settings | Umbraco) after a modal closes and lets the last-registered tab set the title. Re-activate the routed tab's view after Reset's confirm, a cancelled discard, and each load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WAQdHxWd7ft8XjqRAeyGB6
On a full page load the tabs' views register and activate after the views list arrives and after the flag loads, so the last one registered (the demo's About) still won. Reassert once more two frames later. Checked in a browser on Umbraco 17, 18 and 19. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WAQdHxWd7ft8XjqRAeyGB6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The flag workspace's browser tab title should be
{flag name} | {view label} | Umbraco. It broke two ways, both in Umbraco's view-context code (identical in 17.8.2, 18.3.2, 19.0.0-rc1):Settings | Umbraco. The modal is hosted on the workspace context, so its view context parents to the section's view, deactivates ours while open, and on close activates that parent. Nothing re-activates the routed workspace view. Our old secondsetTitle(name)was a no-op (setTitlereturns early when unchanged, and only writes while active).… | Aboutwhile Settings shows._internal_addChildactivates every child view as it registers, without checking it is the routed one, so the last registered view writes the title.Fix: after those events, activate the view context of the tab the URL shows, which rewrites the title.
routed-view.ts: pureroutedViewAlias(views, path)(segment after/view/matched tometa.pathname; none means first view; unknown or no views means null).flag-editor.element.ts: consumesUMB_WORKSPACE_EDITOR_CONTEXTfrom the<umb-workspace-editor>element (it is provided there, below our element) and hands it to the workspace context.flag-workspace.context.ts:setEditorContext()observes the editor'sviews;#reassertTitle()finds the routed view and calls its_internal_activate()(guarded bytypeof). Removed the useless secondsetTitle.Evidence
routed-view.tsdid not exist (no tests for it); after, 6 new tests pass (empty path,view/settings,view/about, unknown, no views, encoded flag name containing/view/).npm test/npx tsc --noEmit -p ./npm run build:dotnet build Umbricians.FeatureFlags.slnx -c Release -p:UmbracoMajor=17: 0 warnings, 0 errors.Browser check (Umbraco 17.8.2, 18.3.2 and 19.0.0-rc1; demo with its extra "About" view;
document.titleread after each step):Checkout.ExpressPay | Settings | Umbraco/view/settings: Settings, not About/view/about: About… | Settings | Umbraco(wasSettings | Umbraco)Feature Flags | Flags | Umbraco)The first version only fixed in-app navigation. On a full page load the title still read "About": a
document.titlesetter trace showed each tab's view activating as it registered, after our reassert. 5ca64e9 reasserts once more two animation frames later, which fixed it on all three.Merge Danger
Door: two-way
Blast Radius: Cosmetic
Uses Umbraco's internal
UmbViewController._internal_activate()(no public API can reactivate the routed view). The call is guarded withtypeof ... === "function", so if Umbraco removes it the title just reverts to Umbraco's own behaviour.Upstream issue draft
Title: Document title falls back to the parent view's after a modal closes; every child view activates on registration
When a modal is opened with
umbOpenModal(host, ...)/umbConfirmModal(host, ...)from a workspace context, the modal's view context finds its parent from the host's parent element (skipping the host) and so parents to the section's view rather than the routed workspace view. While open it deactivates the workspace view; on closedestroy()calls#requestActivateParent(), which activates the section view. The tab title becomesSettings | Umbracoand nothing re-activates the workspace view.setTitle()cannot fix it: it returns early when the title is unchanged and only writes while active.Separately,
UmbViewController._internal_addChildcallschild._internal_activate()whenever the parent is active, without checking the child is the routed view. With several workspace views (e.g. a package adds an extra one), every view activates and the last registered writes the title (… | Aboutwhile the first view is showing).Expected: after a modal closes, the previously active view is re-activated; and only the routed view activates.
Seen in 17.8.2, 18.3.2, 19.0.0-rc1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WAQdHxWd7ft8XjqRAeyGB6