mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
📱 fix: Single-Tap Select for Pinned Agents, Model Specs & Models on Touch (#14272)
The pin/options buttons on these items were hidden-until-hover on ALL pointers (invisible / opacity-0), making each item's rendering hover-dependent. On touch that triggers the iOS "first tap reveals the hover state, second tap activates" behavior, so selecting a model spec, model, or pinned/favorite agent took two taps. Gate the hover-reveal on hover CAPABILITY (the same fix #13712 applied to message hover buttons): the control is visible/tappable by default and only hidden-until-hover on hover-capable pointers via [@media(hover:hover)]. On touch the item is no longer hover-dependent, so the first tap selects. - ModelSpecItem / EndpointModelItem: pin button reveal - FavoriteItem (sidebar pinned agents): options button + wrapper reveal
This commit is contained in:
parent
4321f68f29
commit
d922e1ef79
3 changed files with 18 additions and 4 deletions
|
|
@ -117,7 +117,12 @@ export function EndpointModelItem({ modelId, endpoint }: EndpointModelItemProps)
|
|||
'rounded-md p-1 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring-primary',
|
||||
isFavorite
|
||||
? 'visible'
|
||||
: 'invisible group-focus-within:visible group-hover:visible group-data-[active-item]:visible',
|
||||
: // Visible by default so it's tappable on touch (no hover to
|
||||
// reveal it); only hidden-until-hover on hover-capable pointers.
|
||||
// A hover-gated child would otherwise make the whole item
|
||||
// hover-dependent, so the first tap only reveals it and a second
|
||||
// tap is needed to select (the iOS double-tap).
|
||||
'group-focus-within:visible group-hover:visible group-data-[active-item]:visible [@media(hover:hover)]:invisible',
|
||||
)}
|
||||
>
|
||||
{isFavorite ? (
|
||||
|
|
|
|||
|
|
@ -61,7 +61,12 @@ export function ModelSpecItem({ spec, isSelected }: ModelSpecItemProps) {
|
|||
'rounded-md p-1 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring-primary',
|
||||
isFavorite
|
||||
? 'visible'
|
||||
: 'invisible group-focus-within:visible group-hover:visible group-data-[active-item]:visible',
|
||||
: // Visible by default so it's tappable on touch (no hover to
|
||||
// reveal it); only hidden-until-hover on hover-capable pointers.
|
||||
// A hover-gated child would otherwise make the whole item
|
||||
// hover-dependent, so the first tap only reveals it and a second
|
||||
// tap is needed to select (the iOS double-tap).
|
||||
'group-focus-within:visible group-hover:visible group-data-[active-item]:visible [@media(hover:hover)]:invisible',
|
||||
)}
|
||||
>
|
||||
{isFavorite ? (
|
||||
|
|
|
|||
|
|
@ -152,7 +152,11 @@ export default function FavoriteItem(props: FavoriteItemProps) {
|
|||
'absolute right-2 flex items-center',
|
||||
isPopoverActive
|
||||
? 'pointer-events-auto opacity-100'
|
||||
: 'pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100',
|
||||
: // Interactive by default so it's tappable on touch; only
|
||||
// hidden-until-hover on hover-capable pointers. Otherwise the
|
||||
// whole row is hover-dependent and the first tap just reveals
|
||||
// this instead of selecting (the iOS double-tap).
|
||||
'group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100 [@media(hover:hover)]:pointer-events-none [@media(hover:hover)]:opacity-0',
|
||||
)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
|
|
@ -168,7 +172,7 @@ export default function FavoriteItem(props: FavoriteItemProps) {
|
|||
'inline-flex h-7 w-7 items-center justify-center rounded-md border-none p-0 text-sm font-medium ring-ring-primary transition-all duration-200 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50',
|
||||
isPopoverActive
|
||||
? 'opacity-100'
|
||||
: 'opacity-0 focus:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 data-[open]:opacity-100',
|
||||
: 'focus:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 data-[open]:opacity-100 [@media(hover:hover)]:opacity-0',
|
||||
)}
|
||||
aria-label={localize('com_nav_convo_menu_options')}
|
||||
data-testid="favorite-options-button"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue