Skip to content

Highlight active unit/equipment in ORBAT tree#99

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/highlight-active-unit-in-orbat
Draft

Highlight active unit/equipment in ORBAT tree#99
Copilot wants to merge 6 commits intomainfrom
copilot/highlight-active-unit-in-orbat

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 31, 2025

  • Understand the issue: Active item should be highlighted in ORBAT tree, not just when focused
  • Explore code structure and identify files involved
  • Implement the fix: Add isActive computed property and apply bg-muted-foreground/20 class when item matches selectStore.activeItem
  • Fix duplicate highlighting issue: Remove data-[selected]:bg-muted-foreground/20 from TreeDND.vue to prevent two items from being highlighted at the same time
  • Run type-checking (passed)
  • Request code review (passed)
  • Run CodeQL security check (no issues found)

Summary

This PR fixes the issue where the active unit/equipment was only highlighted in the ORBAT tree when it had keyboard focus.

Changes

File: src/components/orbat/TreeItemDND.vue

  1. Added an isActive computed property that checks if the current tree item matches the active item in the store
  2. Applied the bg-muted-foreground/20 background class when isActive is true

File: src/components/orbat/TreeDND.vue

  1. Removed data-[selected]:bg-muted-foreground/20 to prevent two items from being highlighted simultaneously (one via keyboard focus, one via store active item)

How It Works

  • Before: Background highlight was applied via data-[selected] (keyboard focus) which could result in two highlighted items
  • After: Background highlight is only applied via the isActive computed property which checks the store's activeItem, ensuring only one item is highlighted at a time
Original prompt

This section details on the original issue you should resolve

<issue_title>Active unit/equipment should be highlighted in the ORBAT tree</issue_title>
<issue_description>The active item should be highlighted in the ORBAT. Currently it is only highlighted if the item has focus.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 31, 2025 05:42
Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Copilot AI changed the title [WIP] Highlight active unit in ORBAT tree Highlight active unit/equipment in ORBAT tree Dec 31, 2025
Copilot AI requested a review from kjellmf December 31, 2025 05:49
Copy link
Copy Markdown
Contributor

@kjellmf kjellmf left a comment

Choose a reason for hiding this comment

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

The TreeDND component style the highlighted item using "data-[selected]". This means that you can highlight two items at a time. Fix

Copilot AI and others added 2 commits December 31, 2025 06:12
…ms from being highlighted

Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Co-authored-by: kjellmf <29217+kjellmf@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 31, 2025

The TreeDND component style the highlighted item using "data-[selected]". This means that you can highlight two items at a time. Fix

Fixed in 1086714. Removed data-[selected]:bg-muted-foreground/20 from TreeDND.vue so that only the isActive computed property in TreeItemDND.vue controls the highlighting. This ensures only one item can be highlighted at a time.

Copilot AI requested a review from kjellmf December 31, 2025 06:13
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.

Active unit/equipment should be highlighted in the ORBAT tree

2 participants