mirror of
https://github.com/d0zingcat/BroadcastChannel.git
synced 2026-06-07 23:16:50 +00:00
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:
@@ -20,7 +20,9 @@ const timeago = datetime.isBefore(dayjs().subtract(1, 'w')) ? datetime.format('H
|
|||||||
<div class="time-box">
|
<div class="time-box">
|
||||||
<div class="dot"></div>
|
<div class="dot"></div>
|
||||||
<div class="time">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
{post.content.length > 0 && <div class={`text-box content`} set:html={post.content} />}
|
{post.content.length > 0 && <div class={`text-box content`} set:html={post.content} />}
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ function getReply($, item, { channel }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function modifyHTMLContent($, content, { index } = {}) {
|
function modifyHTMLContent($, content, { index } = {}) {
|
||||||
$(content).find('.emoji')?.attr('style', '')
|
$(content).find('.emoji')?.removeAttr('style')
|
||||||
$(content).find('a')?.each((_index, a) => {
|
$(content).find('a')?.each((_index, a) => {
|
||||||
$(a)?.attr('title', $(a)?.text())?.attr('onclick', '')
|
$(a)?.attr('title', $(a)?.text())?.removeAttr('onclick')
|
||||||
})
|
})
|
||||||
$(content).find('tg-spoiler')?.each((_index, spoiler) => {
|
$(content).find('tg-spoiler')?.each((_index, spoiler) => {
|
||||||
const id = `spoiler-${index}-${_index}`
|
const id = `spoiler-${index}-${_index}`
|
||||||
|
|||||||
Reference in New Issue
Block a user