Skip to content

Commit

Permalink
fix: header dropdown item might not be linkable
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Oct 25, 2024
1 parent 1ead69e commit 9f87bf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions framework/core/js/src/forum/components/HeaderListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface IHeaderListItemAttrs extends ComponentAttrs {
content: string;
excerpt: string;
datetime?: Date;
href: string;
href?: string | null;
onclick?: (e: Event) => void;
actions?: Mithril.Children;
}
Expand All @@ -22,8 +22,18 @@ export default class HeaderListItem<CustomAttrs extends IHeaderListItemAttrs = I
view(vnode: Mithril.Vnode<CustomAttrs, this>) {
const { avatar, icon: iconName, content, excerpt, datetime, href, className, onclick, actions, ...attrs } = vnode.attrs;

const Tag = href ? Link : 'button';

return (
<Link className={classList('HeaderListItem', className)} href={href} external={href.includes('://')} onclick={onclick}>
<Tag
className={classList('HeaderListItem', className, {
'Button--ua-reset': Tag === 'button',
})}
href={href}
external={href?.includes('://')}
onclick={onclick}
{...attrs}
>
{avatar}
<Icon name={iconName} className="HeaderListItem-icon" />
<span className="HeaderListItem-title">
Expand All @@ -33,7 +43,7 @@ export default class HeaderListItem<CustomAttrs extends IHeaderListItemAttrs = I
</span>
<div className="HeaderListItem-actions">{actions}</div>
<div className="HeaderListItem-excerpt">{excerpt}</div>
</Link>
</Tag>
);
}
}
1 change: 1 addition & 0 deletions framework/core/less/forum/HeaderList.less
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
align-items: baseline;
row-gap: 1px;
column-gap: 6px;
cursor: pointer;

// Prevent outline overflowing parent
.add-keyboard-focus-ring-offset(-1px);
Expand Down

0 comments on commit 9f87bf1

Please sign in to comment.