lightbox: Set data-filename as an attribute, not an invalid property.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-02 12:02:10 -07:00 committed by Tim Abbott
parent f07ed8b6b3
commit 518daff9db
2 changed files with 3 additions and 3 deletions

View File

@ -258,7 +258,7 @@ function display_image(payload: Payload): void {
$(".media-description .title")
.text(payload.title ?? "N/A")
.attr("aria-label", payload.title ?? "N/A")
.prop("data-filename", filename ?? "N/A");
.attr("data-filename", filename ?? "N/A");
if (payload.user !== undefined) {
$(".media-description .user").text(payload.user).prop("title", payload.user);
}
@ -303,7 +303,7 @@ function display_video(payload: Payload): void {
$(".media-description .title")
.text(payload.title ?? "N/A")
.attr("aria-label", payload.title ?? "N/A")
.prop("data-filename", filename ?? "N/A");
.attr("data-filename", filename ?? "N/A");
if (payload.user !== undefined) {
$(".media-description .user").text(payload.user).prop("title", payload.user);
}

View File

@ -278,7 +278,7 @@ export function initialize(): void {
if (title === undefined) {
return false;
}
const filename = $(instance.reference).prop("data-filename");
const filename = $(instance.reference).attr("data-filename");
const $markup = $("<span>").text(title);
if (title !== filename) {
// If the image title is the same as the filename, there's no reason