Allow text selection in log entry header (#30638)

GitOrigin-RevId: 18c6c9bc9b2971dbd877ce7d053a2582c6d072ad
This commit is contained in:
Alf Eaton
2026-01-14 15:59:04 +00:00
committed by Copybot
parent 5204ec5d0b
commit 9b6eab9251
2 changed files with 30 additions and 6 deletions

View File

@@ -1,5 +1,12 @@
import classNames from 'classnames'
import { useState, useRef, MouseEventHandler, ElementType } from 'react'
import {
useState,
useRef,
MouseEventHandler,
ElementType,
useCallback,
KeyboardEventHandler,
} from 'react'
import { useTranslation } from 'react-i18next'
import OLTooltip from '@/shared/components/ol/ol-tooltip'
import {
@@ -105,16 +112,30 @@ function LogEntryHeader({
!!fileData &&
!(fileData.entity._id === openEntity?.entity._id && !line)
const handleKeyDown: KeyboardEventHandler<HTMLDivElement> = useCallback(
event => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
onToggleCollapsed()
}
},
[onToggleCollapsed]
)
return (
<header className="log-entry-header-card">
<button
<div
data-action="expand-collapse"
data-collapsed={collapsed}
className="log-entry-header-button"
onClick={onToggleCollapsed}
role="button"
tabIndex={0}
onKeyDown={handleKeyDown}
aria-label={collapsed ? t('expand') : t('collapse')}
>
<MaterialIcon
className="log-entry-expand-icon"
type={
openCollapseIconOverride ??
(collapsed ? 'chevron_right' : 'expand_more')
@@ -135,7 +156,7 @@ function LogEntryHeader({
formattedLocationText
)}
</div>
</button>
</div>
{actionButtonsOverride ?? (
<div className="log-entry-header-actions">

View File

@@ -89,17 +89,20 @@
border-radius: var(--border-radius-base);
padding: var(--spacing-02) 0;
overflow: hidden;
user-select: text;
&:hover {
cursor: pointer;
}
&:hover,
:focus,
:active {
&:focus-visible,
&:active {
background-color: var(--bg-secondary-themed);
}
.log-entry-expand-icon {
user-select: none;
}
}
.log-entry-header-content {