fix(ui): scroll revealed task into view + stronger selection highlight

This commit is contained in:
Mika Kuns
2026-06-25 16:31:54 +02:00
parent e2fad88f37
commit f63be285a2
2 changed files with 19 additions and 1 deletions

View File

@@ -414,7 +414,7 @@
<Setter Property="BorderBrush" Value="{StaticResource LineBrightBrush}" />
</Style>
<Style Selector="Border.task-row.selected">
<Setter Property="BorderBrush" Value="{StaticResource LineBrightBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
<Setter Property="BorderThickness" Value="1" />
</Style>

View File

@@ -1,9 +1,11 @@
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Threading;
using Avalonia.VisualTree;
using ClaudeDo.Ui.ViewModels.Islands;
using ClaudeDo.Ui.ViewModels.Modals;
@@ -36,10 +38,26 @@ public partial class TasksIslandView : UserControl
// ShowDialog completes once the window is closed (CloseAction or OS close).
};
vm.ConfirmAsync = ShowConfirmAsync;
vm.SelectionChanged += (_, _) => ScrollSelectedIntoView();
}
};
}
// Bring the selected row into view — the task list is a plain ItemsControl with no
// built-in selection scrolling, so a programmatic select (e.g. Mission Control's
// "Open in app") would otherwise highlight a row that stays off-screen.
private void ScrollSelectedIntoView()
{
if (DataContext is not TasksIslandViewModel vm || vm.SelectedTask is not { } target) return;
Dispatcher.UIThread.Post(() =>
{
var match = this.GetVisualDescendants()
.OfType<Button>()
.FirstOrDefault(b => ReferenceEquals(b.DataContext, target));
match?.BringIntoView();
}, DispatcherPriority.Background);
}
private async System.Threading.Tasks.Task<bool> ShowConfirmAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;