fix: improve accessibility and remove unnecessary attributes

Enhanced accessibility by wrapping time display in a semantic `<time>` element, ensuring better screen reader support. Removed inline styles and onclick attributes from elements, simplifying the code and improving performance.
This commit is contained in:
ccbikai
2024-09-21 16:39:57 +08:00
parent dac74bc9d8
commit ff418d81a8
2 changed files with 5 additions and 3 deletions

View File

@@ -20,7 +20,9 @@ const timeago = datetime.isBefore(dayjs().subtract(1, 'w')) ? datetime.format('H
<div class="time-box">
<div class="dot"></div>
<div class="time">
<a href={`${SITE_URL}posts/${post.id}`} title={post.datetime} class="item-link">{timeago}</a>
<a href={`${SITE_URL}posts/${post.id}`} title={post.datetime} class="item-link">
<time datetime={post.datetime} title={timeago}>{timeago}</time>
</a>
</div>
</div>
{post.content.length > 0 && <div class={`text-box content`} set:html={post.content} />}