diff --git a/WebApp/Components/Shared/Components/InteractiveChip.razor b/WebApp/Components/Shared/Components/InteractiveChip.razor index 3855a6f..35a2523 100644 --- a/WebApp/Components/Shared/Components/InteractiveChip.razor +++ b/WebApp/Components/Shared/Components/InteractiveChip.razor @@ -1,10 +1,14 @@ @namespace WebApp.Components.Shared.Components +@using Microsoft.AspNetCore.Components.Web + @onmouseleave="@(() => _isHovered = false)" + @ontouchstart="@(() => _isTouched = true)" + @ontouchend="@(() => { /* Prevent mouse events on touch */ })" + @onclick="@HandleClick"> @ChildContent - @if (_isHovered && ControlContent != null) + @if (ControlContent != null) { - @ControlContent - } + @* Always show controls on mobile/touch devices *@ + + @ControlContent + + @* Show on hover for desktop devices *@ + + @if (_isHovered || AlwaysShowControls || _isTouched) + { + @ControlContent + } + + } @@ -46,5 +60,18 @@ [Parameter] public string? WrapperClass { get; set; } + [Parameter] + public bool AlwaysShowControls { get; set; } = false; + private bool _isHovered = false; + private bool _isTouched = false; + + private void HandleClick(MouseEventArgs e) + { + // On touch devices, toggle controls on tap (for devices with both touch and mouse) + if (_isTouched) + { + _isTouched = !_isTouched; + } + } } \ No newline at end of file