Skip to content

Commit 0c0418c

Browse files
committed
Add alt-text to videos, and fix like state on following feed. Fixes #48
1 parent 4f8ea60 commit 0c0418c

4 files changed

Lines changed: 14 additions & 0 deletions

File tree

resources/js/components/Feed/VideoPlayer.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ const props = defineProps({
579579
commentCount: { type: Number, default: 0 },
580580
index: { type: Number, default: 0 },
581581
isSensitive: { type: Boolean, default: false },
582+
altText: { type: String, default: "" },
582583
});
583584
584585
const emit = defineEmits(["interaction"]);
@@ -808,6 +809,14 @@ onMounted(async () => {
808809
});
809810
player.on("ready", () => {
810811
playerReady.value = true;
812+
813+
if (props.altText) {
814+
const el = player.el().querySelector("video");
815+
816+
if (el) {
817+
el.setAttribute("aria-label", props.altText);
818+
}
819+
}
811820
});
812821
player.on("play", function () {
813822
isPaused.value = false;

resources/js/pages/feed/following.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,15 @@ const getVideoProps = (post, index) => ({
109109
caption: post.caption,
110110
hashtags: [],
111111
likes: post.likes,
112+
hasLiked: post.has_liked,
112113
bookmarks: 0,
113114
shares: 0,
114115
comments: [],
116+
canComment: post.permissions?.can_comment,
115117
"comment-count": post.comments,
116118
index: index,
117119
isSensitive: post?.is_sensitive,
120+
altText: post?.media.alt_text,
118121
});
119122
120123
const getVideoKey = (post) => post.id;

resources/js/pages/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const getVideoProps = (post, index) => ({
6262
"comment-count": post.comments,
6363
index: index,
6464
isSensitive: post?.is_sensitive,
65+
altText: post?.media.alt_text,
6566
});
6667
6768
const getVideoKey = (post) => post.id;

resources/js/pages/v/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
loop
153153
controls
154154
class="h-screen mx-auto"
155+
:aria-label="currentVideo.media.alt_text"
155156
:src="currentVideo.media.src_url"
156157
@loadeddata="onVideoLoaded"
157158
@error="onVideoError"

0 commit comments

Comments
 (0)