Skip to content

Do not set icon color if the item is selected #19404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2025

Conversation

lauraneto
Copy link
Contributor

If there's an existing issue for this PR then this fixes #19400

This is an addition to PR #17703, so the same behavior happens for the selected state.
This can be tested using the document picker, multi url picker or by selecting "Allowed child node types" in document or media types.

@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 14:49
Copy link
Contributor

@Copilot 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

Adds support for treating the selected state like the active state when determining icon coloration in tree items.

  • Include _isSelected in the conditional that picks the “iconWithoutColor” variant for active and selected items.
  • Expose _isSelected as a protected property so subclasses can reference it.
  • Update both document and media tree item components, plus the base tree-item renderer.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/packages/media/media/tree/tree-item/media-tree-item.element.ts Updated icon to use iconWithoutColor when the item is selected
src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts Updated icon to use iconWithoutColor when the item is selected
src/packages/core/tree/tree-item/tree-item-base/tree-item-element-base.ts Changed _isSelected to protected and added selected-state check to default icon rendering
Comments suppressed due to low confidence (2)

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-base/tree-item-element-base.ts:74

  • [nitpick] Exposing _isSelected as a protected field breaks encapsulation. Consider keeping it private and providing a protected or public getter isSelected() for subclasses to use.
protected _isSelected = false;

src/Umbraco.Web.UI.Client/src/packages/media/media/tree/tree-item/media-tree-item.element.ts:15

  • There’s new behavior for the selected state affecting icon rendering. Add unit tests to ensure iconWithoutColor is used when _isSelected is true.
<span id="icon-container" slot="icon">

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

Looks good to me and can see it fixes the issue.

image

I've just acted on Copilot's recommendation of a helper method, which seems like a good idea given we have this icon version switch in three places.

If you are happy with my update, please go ahead and merge.

I see there are a few small FE fixes going in still to release/16.0, so I think it would be OK cherry-pick it in there so it's part of RC4, and label the related issue it with this version. - following discussion, let's keep this for 16.1 and not add to 16.0, as it's not a regression in the RC itself.

@AndyButland AndyButland enabled auto-merge (squash) May 28, 2025 08:40
@AndyButland AndyButland merged commit b019f0f into main May 28, 2025
27 checks passed
@AndyButland AndyButland deleted the v16/bugfix/19400-selected-menu-item-icon-color branch May 28, 2025 08:53
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.

V15: Icon color for selected node in link picker
3 participants