Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/shared/src/components/profile/ProfileTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export function ProfileTooltip({
content: !isLoading && data ? <UserEntityCard user={data} /> : null,
plugins:
onTooltipMouseEnter || onTooltipMouseLeave ? [hoverPlugin] : undefined,
// Remove focus from trigger to prevent keyboard accessibility issues
trigger: 'mouseenter',
...tooltip,
onShow: (instance) => {
if (id !== userId) {
Expand Down
42 changes: 34 additions & 8 deletions packages/shared/src/components/profile/UserShortInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import { formatCoresCurrency } from '../../lib/utils';
import { Image } from '../image/Image';
import { ButtonVariant } from '../buttons/Button';

const getProfileUrl = (username: string): string => {
return `https://app.daily.dev/${username}`;
};

type PropsOf<Tag> = Tag extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[Tag]
: Tag extends React.ComponentType<infer Props>
Expand Down Expand Up @@ -97,15 +101,37 @@ const UserShortInfoComponent = <Tag extends React.ElementType>(
visible: disableTooltip ? false : undefined,
};

const handleKeyDown = (event: React.KeyboardEvent) => {
if ((event.key === 'Enter' || event.key === ' ') && !onClick) {
event.preventDefault();
// Navigate to full profile page instead of showing popup
window.open(getProfileUrl(username), '_blank');
}
};

// Add proper keyboard accessibility
const accessibilityProps =
tag === 'a'
? {}
: {
tabIndex: 0,
role: 'button' as const,
'aria-label': `View ${name}'s profile`,
onKeyDown: handleKeyDown,
};

const elementProps = {
ref,
...props,
className: classNames(
'flex flex-row',
className.container ?? defaultClassName.container,
),
...accessibilityProps,
};

return (
<Element
ref={ref}
{...props}
className={classNames(
'flex flex-row',
className.container ?? defaultClassName.container,
)}
>
<Element {...elementProps}>
<ProfileTooltip
userId={user?.id}
tooltip={tooltipProps}
Expand Down