Skip to content

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

Update appearance of sensitive image thumbnails (#4831)

Dhruv Bhanushali2186477f8605
diff --git a/frontend/src/assets/svg/raw/eye-closed.svg b/frontend/src/assets/svg/raw/eye-closed.svg
index 5531fde5f..469a1f5cc 100644
--- a/frontend/src/assets/svg/raw/eye-closed.svg
+++ b/frontend/src/assets/svg/raw/eye-closed.svg
@@ -1,5 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M16.4229 3.69896L15.5477 3.28711L13.6178 7.38822C13.1078 7.29926 12.5685 7.25002 11.9997 7.25002C9.00215 7.25002 6.82626 8.61761 5.41999 9.95692C4.71748 10.626 4.19996 11.2938 3.85706 11.7956C3.68523 12.0471 3.55617 12.2584 3.46872 12.4096C3.42496 12.4852 3.39154 12.5459 3.3683 12.5892C3.35668 12.6108 3.3476 12.6282 3.34104 12.6408L3.33309 12.6563L3.33053 12.6614L3.3296 12.6632C3.32943 12.6635 3.32891 12.6646 3.99973 13C4.67055 13.3354 4.67042 13.3357 4.67029 13.3359L4.6731 13.3305C4.67633 13.3242 4.68196 13.3135 4.69 13.2985C4.70607 13.2686 4.73172 13.2218 4.76707 13.1608C4.83782 13.0385 4.94704 12.8592 5.09553 12.6419C5.39324 12.2062 5.84448 11.624 6.45447 11.0431C7.6732 9.88243 9.49731 8.75002 11.9997 8.75002C12.3283 8.75002 12.6452 8.76954 12.9505 8.80609L12.8144 9.09534C12.553 9.03302 12.2802 9.00002 11.9997 9.00002C10.0667 9.00002 8.49973 10.567 8.49973 12.5C8.49973 13.6433 9.04793 14.6586 9.89583 15.2974L7.54771 20.2871L8.43108 20.7028L16.4229 3.69896ZM12.305 15.9869C14.095 15.8322 15.4997 14.3302 15.4997 12.5C15.4997 11.7607 15.2705 11.0749 14.8792 10.5098L12.305 15.9869ZM15.3505 9.5071C16.2283 9.9299 16.9571 10.4832 17.545 11.0431C18.155 11.624 18.6062 12.2062 18.9039 12.6419C19.0524 12.8592 19.1616 13.0385 19.2324 13.1608C19.2677 13.2218 19.2934 13.2686 19.3094 13.2985C19.3175 13.3135 19.3231 13.3242 19.3263 13.3305L19.3292 13.3359C19.3292 13.3356 19.3408 13.3295 19.9997 13C20.6705 12.6646 20.6704 12.6643 20.6702 12.664L20.6689 12.6614L20.6663 12.6563L20.6584 12.6408C20.6518 12.6282 20.6428 12.6108 20.6311 12.5892C20.6079 12.5459 20.5745 12.4852 20.5307 12.4096C20.4433 12.2584 20.3142 12.0471 20.1424 11.7956C19.7995 11.2938 19.282 10.626 18.5795 9.95692C17.8984 9.30822 17.0367 8.65289 15.9885 8.14954L15.3505 9.5071Z"
- fill="#30272E" />
+ fill="currentColor" />
</svg>
diff --git a/frontend/src/assets/svg/raw/eye-open.svg b/frontend/src/assets/svg/raw/eye-open.svg
index 843bd90a1..8270e1551 100644
--- a/frontend/src/assets/svg/raw/eye-open.svg
+++ b/frontend/src/assets/svg/raw/eye-open.svg
@@ -1,5 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M4.49961 13.5C5.17043 13.8354 5.1703 13.8357 5.17017 13.8359L5.17298 13.8305C5.17621 13.8242 5.18184 13.8135 5.18988 13.7985C5.20595 13.7686 5.2316 13.7218 5.26695 13.6608C5.3377 13.5385 5.44692 13.3592 5.59541 13.1419C5.89312 12.7062 6.34436 12.124 6.95435 11.5431C8.17308 10.3824 9.99719 9.25 12.4996 9.25C15.002 9.25 16.8261 10.3824 18.0449 11.5431C18.6549 12.124 19.1061 12.7062 19.4038 13.1419C19.5523 13.3592 19.6615 13.5385 19.7323 13.6608C19.7676 13.7218 19.7933 13.7686 19.8093 13.7985C19.8174 13.8135 19.823 13.8242 19.8262 13.8305L19.8291 13.8359C19.8289 13.8357 19.8288 13.8354 20.4996 13.5C21.1704 13.1646 21.1703 13.1643 21.1701 13.164L21.1688 13.1614L21.1662 13.1563L21.1583 13.1408C21.1517 13.1282 21.1427 13.1108 21.131 13.0892C21.1078 13.0459 21.0744 12.9852 21.0306 12.9096C20.9432 12.7584 20.8141 12.5471 20.6423 12.2956C20.2994 11.7938 19.7819 11.126 19.0794 10.4569C17.6731 9.11759 15.4972 7.75 12.4996 7.75C9.50203 7.75 7.32614 9.11759 5.91987 10.4569C5.21736 11.126 4.69984 11.7938 4.35694 12.2956C4.18511 12.5471 4.05605 12.7584 3.9686 12.9096C3.92484 12.9852 3.89142 13.0459 3.86818 13.0892C3.85656 13.1108 3.84748 13.1282 3.84092 13.1408L3.83297 13.1563L3.83041 13.1614L3.82948 13.1632C3.82931 13.1635 3.82879 13.1646 4.49961 13.5ZM12.4996 16.5C14.4326 16.5 15.9996 14.933 15.9996 13C15.9996 11.067 14.4326 9.5 12.4996 9.5C10.5666 9.5 8.99961 11.067 8.99961 13C8.99961 14.933 10.5666 16.5 12.4996 16.5Z"
- fill="#30272E" />
+ fill="currentColor" />
</svg>
diff --git a/frontend/src/assets/svg/sprite/icons.svg b/frontend/src/assets/svg/sprite/icons.svg
index 615db5de8..c12476170 100644
--- a/frontend/src/assets/svg/sprite/icons.svg
+++ b/frontend/src/assets/svg/sprite/icons.svg
@@ -11,8 +11,8 @@
<symbol id="close" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="1.5" d="M5.405 5 19 19M5 19 18.595 5"/></symbol>
<symbol id="error" fill="none" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="M12 20.75a8.75 8.75 0 1 0 0-17.5 8.75 8.75 0 0 0 0 17.5M19.25 12a7.25 7.25 0 0 1-11.785 5.657L17.657 7.465A7.22 7.22 0 0 1 19.25 12m-2.648-5.602A7.25 7.25 0 0 0 6.398 16.602z" clip-rule="evenodd"/></symbol>
<symbol id="external-link" fill="none" viewBox="0 0 24 24"><g stroke="currentColor" stroke-width="1.5"><path d="M10.25 5H7a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3.639M14.895 3.786l5.547-.025m0 0-.047 5.525m.047-5.525-7.68 7.681"/></g></symbol>
-<symbol id="eye-closed" fill="none" viewBox="0 0 24 24"><path fill="#30272E" fill-rule="evenodd" d="m16.423 3.699-.875-.412-1.93 4.101A9.4 9.4 0 0 0 12 7.25c-2.998 0-5.174 1.368-6.58 2.707-.703.669-1.22 1.337-1.563 1.839a10 10 0 0 0-.516.845l-.008.015-.002.005-.001.002s-.001.002.67.337l.67.336.003-.005.017-.032.077-.138c.07-.122.18-.302.329-.52.297-.435.748-1.017 1.358-1.598C7.674 9.883 9.497 8.75 12 8.75q.492.001.95.056l-.136.29a3.5 3.5 0 0 0-2.919 6.202l-2.347 4.99.883.415zm-4.118 12.288a3.5 3.5 0 0 0 2.574-5.477zm3.046-6.48a8.6 8.6 0 0 1 2.194 1.536c.61.581 1.061 1.163 1.359 1.599a8 8 0 0 1 .422.689l.003.005L20 13c.672-.335.671-.336.671-.336l-.001-.003-.003-.005-.008-.015-.027-.052-.1-.18a10 10 0 0 0-.389-.613c-.343-.502-.86-1.17-1.562-1.84a10.1 10.1 0 0 0-2.591-1.806z" clip-rule="evenodd"/></symbol>
-<symbol id="eye-open" fill="none" viewBox="0 0 24 24"><path fill="#30272E" d="m4.5 13.5.67.336.003-.005.017-.032.077-.138c.07-.122.18-.302.328-.52.298-.435.75-1.017 1.36-1.598C8.172 10.383 9.996 9.25 12.5 9.25c2.502 0 4.326 1.132 5.545 2.293.61.581 1.061 1.163 1.359 1.599a8 8 0 0 1 .422.689l.003.005.67-.336.671-.336-.001-.003-.003-.005-.008-.015-.027-.052-.1-.18a10 10 0 0 0-.389-.613c-.343-.502-.86-1.17-1.563-1.84-1.406-1.338-3.582-2.706-6.58-2.706-2.997 0-5.173 1.368-6.58 2.707-.702.669-1.22 1.337-1.562 1.839a10 10 0 0 0-.516.845l-.008.015-.003.005v.002s-.001.002.67.337m8 3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7"/></symbol>
+<symbol id="eye-closed" fill="none" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="m16.423 3.699-.875-.412-1.93 4.101A9.4 9.4 0 0 0 12 7.25c-2.998 0-5.174 1.368-6.58 2.707-.703.669-1.22 1.337-1.563 1.839a10 10 0 0 0-.516.845l-.008.015-.002.005-.001.002s-.001.002.67.337l.67.336.003-.005.017-.032.077-.138c.07-.122.18-.302.329-.52.297-.435.748-1.017 1.358-1.598C7.674 9.883 9.497 8.75 12 8.75q.492.001.95.056l-.136.29a3.5 3.5 0 0 0-2.919 6.202l-2.347 4.99.883.415zm-4.118 12.288a3.5 3.5 0 0 0 2.574-5.477zm3.046-6.48a8.6 8.6 0 0 1 2.194 1.536c.61.581 1.061 1.163 1.359 1.599a8 8 0 0 1 .422.689l.003.005L20 13c.672-.335.671-.336.671-.336l-.001-.003-.003-.005-.008-.015-.027-.052-.1-.18a10 10 0 0 0-.389-.613c-.343-.502-.86-1.17-1.562-1.84a10.1 10.1 0 0 0-2.591-1.806z" clip-rule="evenodd"/></symbol>
+<symbol id="eye-open" fill="none" viewBox="0 0 24 24"><path fill="currentColor" d="m4.5 13.5.67.336.003-.005.017-.032.077-.138c.07-.122.18-.302.328-.52.298-.435.75-1.017 1.36-1.598C8.172 10.383 9.996 9.25 12.5 9.25c2.502 0 4.326 1.132 5.545 2.293.61.581 1.061 1.163 1.359 1.599a8 8 0 0 1 .422.689l.003.005.67-.336.671-.336-.001-.003-.003-.005-.008-.015-.027-.052-.1-.18a10 10 0 0 0-.389-.613c-.343-.502-.86-1.17-1.563-1.84-1.406-1.338-3.582-2.706-6.58-2.706-2.997 0-5.173 1.368-6.58 2.707-.702.669-1.22 1.337-1.562 1.839a10 10 0 0 0-.516.845l-.008.015-.003.005v.002s-.001.002.67.337m8 3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7"/></symbol>
<symbol id="flag" fill="none" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="M4.5 4h9l.4 2h5.6v10h-7l-.4-2H6.5v7h-2zm7.76 4-.4-2H6.5v6h7.24l.4 2h3.36V8z" clip-rule="evenodd"/></symbol>
<symbol id="filter" fill="none" viewBox="0 0 24 24"><g fill="currentColor"><path d="M5 7h14v1.5H5zM7 11.25h10v1.5H7zM9 15.5h6V17H9z"/></g></symbol>
<symbol id="image" fill="none" viewBox="0 0 24 24"><g fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"><path d="M19 4.5H5a.5.5 0 0 0-.5.5v14a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V5a.5.5 0 0 0-.5-.5M5 3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z"/><path d="M15.477 10.462a.75.75 0 0 1 1.046 0l4 3.89-1.046 1.075L16 12.046l-3.477 3.38a.75.75 0 0 1-.93.092l-2.997-1.941-4.154 3.029-.884-1.212 4.572-3.333a.75.75 0 0 1 .85-.024l2.926 1.897z"/></g></symbol>
diff --git a/frontend/src/components/VAudioThumbnail/VAudioThumbnail.vue b/frontend/src/components/VAudioThumbnail/VAudioThumbnail.vue
index b7709abc7..2559bdaa9 100644
--- a/frontend/src/components/VAudioThumbnail/VAudioThumbnail.vue
+++ b/frontend/src/components/VAudioThumbnail/VAudioThumbnail.vue
@@ -93,7 +93,7 @@ const radius = (i: number, j: number) => {
<!-- The element that blurs the programmatic thumbnail -->
<div
v-show="shouldBlur && !audio.thumbnail"
- class="bg-blur absolute bg-complementary"
+ class="absolute bg-complementary"
/>
<div v-show="audio.thumbnail && isOk" class="thumbnail absolute inset-0">
diff --git a/frontend/src/components/VImageCell/VImageCell.vue b/frontend/src/components/VImageCell/VImageCell.vue
index ec7334771..6cbeca221 100644
--- a/frontend/src/components/VImageCell/VImageCell.vue
+++ b/frontend/src/components/VImageCell/VImageCell.vue
@@ -12,6 +12,7 @@ import { IMAGE } from "~/constants/media"
import { useSearchStore } from "~/stores/search"
+import VIcon from "~/components/VIcon/VIcon.vue"
import VLicense from "~/components/VLicense/VLicense.vue"
import VLink from "~/components/VLink.vue"
@@ -94,13 +95,15 @@ const getImgDimension = (event: Event) => {
imgWidth.value = element.naturalWidth
}
-const contextSensitiveTitle = computed(() => {
- return shouldBlur.value
- ? t("sensitiveContent.title.image")
- : t("browsePage.aria.imageTitle", {
- title: props.image.title,
- })
+const imageTitle = t("browsePage.aria.imageTitle", {
+ title: props.image.title,
})
+const contextSensitiveLabel = computed(() =>
+ shouldBlur.value ? t("sensitiveContent.title.image") : imageTitle
+)
+const contextSensitiveTitle = computed(() =>
+ shouldBlur.value ? undefined : imageTitle
+)
const { $sendCustomEvent } = useNuxtApp()
const searchStore = useSearchStore()
@@ -143,8 +146,8 @@ const { isHidden: shouldBlur } = useSensitiveMedia(props.image)
itemprop="contentUrl"
:title="contextSensitiveTitle"
:href="imageLink"
- class="group relative block w-full overflow-hidden rounded-sm text-gray-2 focus-visible:outline-3 focus-visible:outline-offset-4"
- :aria-label="contextSensitiveTitle"
+ class="group relative block w-full overflow-hidden rounded-sm text-gray-2 hover:no-underline focus-visible:outline-3 focus-visible:outline-offset-4"
+ :aria-label="contextSensitiveLabel"
@mousedown="sendSelectSearchResultEvent"
>
<figure
@@ -156,11 +159,8 @@ const { isHidden: shouldBlur } = useSensitiveMedia(props.image)
>
<img
loading="lazy"
- class="image col-span-full row-span-full block w-full overflow-hidden rounded-sm object-cover duration-200 motion-safe:transition-[filter,transform]"
- :class="[
- isSquare ? 'h-full' : 'margin-auto',
- { 'scale-150 blur-image': shouldBlur },
- ]"
+ class="image col-span-full row-span-full block w-full overflow-hidden rounded-sm object-cover"
+ :class="[isSquare ? 'h-full' : 'margin-auto']"
:alt="
shouldBlur ? `${$t('sensitiveContent.title.image')}` : image.title
"
@@ -171,24 +171,37 @@ const { isHidden: shouldBlur } = useSensitiveMedia(props.image)
@load="getImgDimension"
@error="onImageLoadError($event)"
/>
+ <span
+ class="col-span-full row-span-full flex items-center justify-center bg-blur text-default backdrop-blur-xl duration-200 motion-safe:transition-opacity"
+ :class="shouldBlur ? 'opacity-100' : 'opacity-0'"
+ data-testid="blur-overlay"
+ aria-hidden="true"
+ >
+ <VIcon name="eye-closed" />
+ </span>
<figcaption
- class="col-span-full self-end justify-self-start rounded-sm bg-default text-default group-hover:visible group-focus-visible:visible"
- :class="
+ class="z-10 col-span-full my-2 self-end justify-self-start rounded-sm text-default group-hover:visible group-focus-visible:visible"
+ :class="[
isSquare
- ? 'invisible row-span-full m-2 p-2'
- : 'my-2 sm:invisible sm:row-span-full sm:m-2 sm:p-2'
- "
+ ? 'invisible row-span-full p-2'
+ : 'sm:invisible sm:row-span-full sm:p-2',
+ shouldBlur ? 'sm:w-full sm:text-center' : 'bg-default',
+ !shouldBlur && (isSquare ? 'mx-2' : 'sm:mx-2'),
+ ]"
>
<h2 class="sr-only">
{{
shouldBlur ? `${$t("sensitiveContent.title.image")}` : image.title
}}
</h2>
- <VLicense
- :license="image.license"
- :hide-name="true"
- class="text-secondary group-hover:text-default group-focus-visible:text-default sm:text-default"
- />
+ <div
+ class="label-regular leading-none text-secondary group-hover:text-default group-focus-visible:text-default sm:text-default"
+ >
+ <template v-if="shouldBlur">
+ {{ $t("sensitiveContent.singleResult.title") }}
+ </template>
+ <VLicense v-else :license="image.license" :hide-name="true" />
+ </div>
</figcaption>
</figure>
</VLink>
diff --git a/frontend/src/styles/tailwind.css b/frontend/src/styles/tailwind.css
index 5e0af78cb..b46da9235 100644
--- a/frontend/src/styles/tailwind.css
+++ b/frontend/src/styles/tailwind.css
@@ -9,6 +9,7 @@
:root {
--color-black: #000;
+ --color-black-72: #000000b8;
--color-white: #fff;
--color-yellow-3: #fde034;
--color-pink-8: #ad1f85;
@@ -69,6 +70,7 @@
--color-gray-12-80: #232323cc;
--color-gray-12-90: #232323e5;
--color-gray-13-0: #0d0d0d00;
+ --color-white-72: #ffffffb8;
--color-white-0: #fff0;
--color-info-1: #f5f7fb;
--color-info-2: #e6edfc;
@@ -231,6 +233,7 @@
--color-bg-error: var(--color-error-2);
--color-bg-disabled: var(--color-gray-5);
--color-bg-zero: var(--color-white-0);
+ --color-bg-blur: var(--color-white-72);
--color-border: var(--color-gray-3);
--color-border-hover: var(--color-gray-12);
--color-border-secondary: var(--color-gray-12-20);
@@ -274,6 +277,7 @@
--color-bg-error: var(--color-error-11);
--color-bg-disabled: var(--color-gray-8);
--color-bg-zero: var(--color-gray-13-0);
+ --color-bg-blur: var(--color-black-72);
--color-border: var(--color-gray-11);
--color-border-hover: var(--color-gray-1);
--color-border-secondary: var(--color-gray-1-20);
diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.ts
index bac0136c9..d22dbdb9f 100644
--- a/frontend/tailwind.config.ts
+++ b/frontend/tailwind.config.ts
@@ -340,6 +340,7 @@ export default {
error: "var(--color-bg-error)",
disabled: "var(--color-bg-disabled)",
zero: "var(--color-bg-zero)",
+ blur: "var(--color-bg-blur)",
},
borderColor: {
default: "var(--color-border)",
diff --git a/frontend/test/unit/specs/components/v-image-cell.spec.js b/frontend/test/unit/specs/components/v-image-cell.spec.js
index 41478ed7f..972234198 100644
--- a/frontend/test/unit/specs/components/v-image-cell.spec.js
+++ b/frontend/test/unit/specs/components/v-image-cell.spec.js
@@ -36,9 +36,9 @@ describe("VImageCell", () => {
it("is blurred when the image is sensitive", async () => {
options.props.image.isSensitive = true
- const { getByAltText } = await render(VImageCell, options)
- const img = getByAltText("This image may contain sensitive content.")
- expect(img).toHaveClass("blur-image")
+ const { getByTestId } = await render(VImageCell, options)
+ const overlay = getByTestId("blur-overlay")
+ expect(overlay).toBeVisible()
})
it("is does not contain title anywhere when the image is sensitive", async () => {