Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Fix global audio player's close button (#927)

Olga Bulat3077ce7f7037
diff --git a/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue b/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue
index fe49c5edc..0bb7fc628 100644
--- a/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue
+++ b/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue
@@ -3,9 +3,10 @@
<VGlobalAudioTrack v-if="audio" :audio="audio" />
<VIconButton
v-if="audio"
- class="absolute top-0 z-10 border-none ltr:right-0 rtl:left-0"
+ class="absolute top-0 z-30 border-none ltr:right-0 rtl:left-0"
size="large"
:icon-props="{ iconPath: icons.closeIcon }"
+ :aria-label="$t('audio-track.close')"
@click="handleClose"
/>
</div>
diff --git a/frontend/src/locales/scripts/en.json5 b/frontend/src/locales/scripts/en.json5
index 3d7a6fc54..f01d48580 100644
--- a/frontend/src/locales/scripts/en.json5
+++ b/frontend/src/locales/scripts/en.json5
@@ -607,6 +607,7 @@
loading: "Loading...",
},
creator: "by {creator}",
+ close: "Close the audio player",
},
"play-pause": {
play: "Play",
diff --git a/frontend/test/locales/ar.json b/frontend/test/locales/ar.json
index 4db5d5f19..1753660aa 100644
--- a/frontend/test/locales/ar.json
+++ b/frontend/test/locales/ar.json
@@ -104,7 +104,8 @@
"err_decode": "تعذر فك تشفير الصوت.",
"err_unsupported": "لا يدعم متصفحك تنسيق الصوت هذا.",
"loading": "جار التحميل..."
- }
+ },
+ "close": "أغلق مشغل الصوت"
},
"audio-thumbnail": {
"alt": "صورة الغلاف لـ \"{title}\" بواسطة {creator}"
diff --git a/frontend/test/playwright/e2e/global-audio.spec.ts b/frontend/test/playwright/e2e/global-audio.spec.ts
index 76d3cf4ba..ad4a835be 100644
--- a/frontend/test/playwright/e2e/global-audio.spec.ts
+++ b/frontend/test/playwright/e2e/global-audio.spec.ts
@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test"
-import { sleep } from "~~/test/playwright/utils/navigation"
+import { sleep, t } from "~~/test/playwright/utils/navigation"
import breakpoints from "~~/test/playwright/utils/breakpoints"
import audio from "~~/test/playwright/utils/audio"
@@ -24,6 +24,24 @@ test.describe("Global Audio", () => {
)
})
+ test("track can be closed while playing", async ({ page }) => {
+ await page.goto("/search/audio?q=honey")
+ // Find and play the first audio result
+ const firstAudioRow = await audio.getNthAudioRow(page, 0)
+ await audio.play(firstAudioRow)
+
+ // Click in the middle of the player. After this, the player can be closed
+ await page.mouse.click(170, 650)
+
+ // Close the player
+ await page
+ .locator(".global-audio")
+ .getByRole("button", { name: t("audio-track.close") })
+ .click()
+ // and confirm the player is not visible
+ await expect(page.locator(".global-audio")).not.toBeVisible()
+ })
+
test("player does not reproduce an audio different that the current audio in the details page", async ({
page,
}) => {