-
+
@@ -152,7 +152,7 @@ watch(route, () => {
@close="closePageMenu"
/>
-
+
diff --git a/frontend/src/components/VHeader/VHomeLink.vue b/frontend/src/components/VHeader/VHomeLink.vue
index 41421cbb812..44771a69082 100644
--- a/frontend/src/components/VHeader/VHomeLink.vue
+++ b/frontend/src/components/VHeader/VHomeLink.vue
@@ -3,22 +3,8 @@
* The home link for the internal header. Shows the Openverse logo and wordmark,
* and does not have a loading state.
*/
-
import VButton from "~/components/VButton.vue"
import VSvg from "~/components/VSvg/VSvg.vue"
-
-withDefaults(
- defineProps<{
- /**
- * In `light` mode, the links are white and the background is dark charcoal.
- * In `dark` mode, the links are dark charcoal and the background is transparent.
- *
- * @default 'light'
- */
- variant?: "light" | "dark"
- }>(),
- { variant: "light" }
-)
@@ -28,12 +14,7 @@ withDefaults(
:aria-label="$t('header.homeLink', { openverse: 'Openverse' })"
variant="transparent-tx"
size="disabled"
- :class="
- variant === 'dark'
- ? 'text-default hover:bg-complementary'
- : 'focus-slim-tx-bg-complementary text-white'
- "
- class="h-12 px-4 text-[1.125rem]"
+ class="h-12 px-4 text-[1.125rem] text-contrast"
>
import VLink from "~/components/VLink.vue"
import VSvg from "~/components/VSvg/VSvg.vue"
-
-withDefaults(
- defineProps<{
- mode?: "dark" | "light"
- }>(),
- { mode: "light" }
-)
export default meta
@@ -26,9 +16,7 @@ export const Default: Story = {
render: (args) => ({
components: { VHomeLink },
setup() {
- const bg = args.variant === "dark" ? "bg-default" : "bg-black"
- return () =>
- h("div", { class: `flex p-4 ${bg}` }, h(VHomeLink, { ...args }))
+ return () => h("div", { class: `flex p-4` }, h(VHomeLink, { ...args }))
},
}),
name: "Default",
diff --git a/frontend/src/components/VImageCell/VImageCell.vue b/frontend/src/components/VImageCell/VImageCell.vue
index a80d9a47db3..a0554f70d99 100644
--- a/frontend/src/components/VImageCell/VImageCell.vue
+++ b/frontend/src/components/VImageCell/VImageCell.vue
@@ -147,7 +147,7 @@ const { isHidden: shouldBlur } = useSensitiveMedia(props.image)
:class="
isSquare
? 'focus-visible:focus-bold-filled'
- : 'focus-slim-tx focus-visible:-m-2 focus-visible:w-[calc(100%+theme(spacing.4))] focus-visible:p-2 sm:focus-visible:m-0 sm:focus-visible:w-full sm:focus-visible:p-0 focus-visible:sm:focus-bold-filled'
+ : 'focus-visible:-m-2 focus-visible:w-[calc(100%+theme(spacing.4))] focus-visible:p-2 focus-visible:focus-slim-tx sm:focus-visible:m-0 sm:focus-visible:w-full sm:focus-visible:p-0 focus-visible:sm:focus-bold-filled'
"
:aria-label="contextSensitiveLabel"
@mousedown="sendSelectSearchResultEvent"
diff --git a/frontend/src/components/VMediaInfo/VMetadataValue.vue b/frontend/src/components/VMediaInfo/VMetadataValue.vue
index 3446c52b15d..3b45b5a4eb8 100644
--- a/frontend/src/components/VMediaInfo/VMetadataValue.vue
+++ b/frontend/src/components/VMediaInfo/VMetadataValue.vue
@@ -18,7 +18,7 @@ defineEmits<{
{
+ const height = modalHeaderHeight.value
+ const mode = props.mode
+ const style = {
+ "--modal-header-height": `${height}px`,
+ }
+ if (mode !== "dark") {
+ return style
+ }
+ return {
+ ...style,
+ "--color-contrast": "var(--color-white)",
+ "--color-focus-ring": "var(--color-yellow-4)",
+ }
+})
+
defineExpose({
dialogRef,
deactivateFocusTrap,
@@ -134,7 +150,7 @@ defineExpose({
'm-6 max-w-90 rounded sm:m-0 sm:w-90': variant === 'centered',
},
]"
- :style="`--modal-header-height: ${modalHeaderHeight}px;`"
+ :style="modalStyle"
role="dialog"
aria-modal="true"
@keydown="onKeyDown"
@@ -201,6 +217,7 @@ defineExpose({
: mode === 'dark'
? 'bg-black'
: 'bg-overlay',
+ `modal-content-${mode}`,
]"
>
@@ -229,4 +246,8 @@ by the address bar.
max-height: calc(100vh - var(--modal-header-height, 0) - 6rem);
overflow-y: scroll;
}
+.modal-content-dark {
+ --color-outline-focus: var(--color-yellow-3);
+ --color-contrast: var(--color-white);
+}
diff --git a/frontend/src/components/VRadio/VRadio.vue b/frontend/src/components/VRadio/VRadio.vue
index be4850ae1c5..185c9c0063d 100644
--- a/frontend/src/components/VRadio/VRadio.vue
+++ b/frontend/src/components/VRadio/VRadio.vue
@@ -42,7 +42,7 @@ const handleInput = () => {
:id="id"
v-bind="$attrs"
:value="value"
- class="radio focus-visible:ring-border-focus relative me-3 h-5 w-5 flex-shrink-0 appearance-none rounded-full border border-tertiary bg-default focus-visible:outline-none focus-visible:ring focus-visible:ring-offset-2 disabled:border-disabled disabled:bg-secondary"
+ class="radio relative me-3 h-5 w-5 flex-shrink-0 appearance-none rounded-full border border-tertiary bg-default focus-visible:outline-none focus-visible:ring focus-visible:ring-focus-ring focus-visible:ring-offset-2 disabled:border-disabled disabled:bg-secondary"
type="radio"
:checked="isChecked"
@input="handleInput"
diff --git a/frontend/src/components/VTabs/VTab.vue b/frontend/src/components/VTabs/VTab.vue
index 1df9437ad86..d0b590d434f 100644
--- a/frontend/src/components/VTabs/VTab.vue
+++ b/frontend/src/components/VTabs/VTab.vue
@@ -159,7 +159,7 @@ const variant = computed(() => tabContext.variant.value)
size="disabled"
variant="plain--avoid"
v-bind="tabProps"
- class="rounded-none bg-default focus-slim-tx focus:z-10"
+ class="rounded-none bg-default focus:z-10 focus-visible:focus-slim-tx"
:class="[variant, `size-${size}`, { [`${variant}-selected`]: isSelected }]"
@click="handleSelection"
@focus="handleFocus"
diff --git a/frontend/src/components/meta/Focus.stories.js b/frontend/src/components/meta/Focus.stories.js
index f4e282e5579..fa6db9b6ce8 100644
--- a/frontend/src/components/meta/Focus.stories.js
+++ b/frontend/src/components/meta/Focus.stories.js
@@ -27,7 +27,7 @@ export const SlimTransparent = {
name: "Slim transparent",
args: {
- classNames: ["focus-slim-tx"],
+ classNames: ["focus-visible:focus-slim-tx"],
},
}
diff --git a/frontend/src/styles/tailwind.css b/frontend/src/styles/tailwind.css
index a98fc92baf0..7e811b866e7 100644
--- a/frontend/src/styles/tailwind.css
+++ b/frontend/src/styles/tailwind.css
@@ -177,6 +177,7 @@
--color-border-focus: var(--color-pink-8);
--color-border-bg-ring: var(--color-white);
--color-border-disabled: var(--color-gray-5);
+ --color-focus-ring: var(--color-pink-8);
/* Text */
--color-text: var(--color-gray-12);
@@ -236,6 +237,7 @@
--color-border-focus: var(--color-yellow-4);
--color-border-bg-ring: var(--color-gray-13);
--color-border-disabled: var(--color-gray-8);
+ --color-focus-ring: var(--color-yellow-4);
/* Text */
--color-text: var(--color-gray-1);
@@ -297,6 +299,7 @@
--color-border-focus: var(--color-pink-8);
--color-border-bg-ring: var(--color-white);
--color-border-disabled: var(--color-gray-5);
+ --color-focus-ring: var(--color-pink-8);
/* Text */
--color-text: var(--color-gray-12);
@@ -357,6 +360,7 @@
--color-border-focus: var(--color-yellow-4);
--color-border-bg-ring: var(--color-gray-13);
--color-border-disabled: var(--color-gray-8);
+ --color-focus-ring: var(--color-yellow-4);
/* Text */
--color-text: var(--color-gray-1);
@@ -532,13 +536,14 @@ Time - 11px - xs semibold (default leading-tight)
@apply ring-offset-1;
}
- [class*="focus-slim-tx"] {
- @apply focus-visible:outline-none; /* UA styles: none */
- @apply focus-visible:ring; /* outer-stroke: box-shadow */
- @apply focus-visible:border-tx; /* inner-stroke: transparent border */
+ .focus-slim-tx {
+ @apply outline-style-none; /* UA styles: none */
+ @apply ring; /* outer-stroke: box-shadow */
+ @apply border-tx; /* inner-stroke: transparent border */
/* It is up to the component to apply border utilities. */
- @apply focus-visible:hover:border-tx; /* focus prevails over hover */
+ @apply hover:border-tx; /* focus prevails over hover */
+ @apply ring-[--color-focus-ring]; /* default ring color */
}
[class*="focus-slim-filled"] {
@@ -565,6 +570,8 @@ Time - 11px - xs semibold (default leading-tight)
@apply after:pointer-events-none after:absolute after:inset-0 after:rounded-inherit;
@apply after:z-10 after:shadow-bold-filled; /* inner-stroke: pseudo-element */
+
+ @apply ring-[--color-focus-ring]; /* default ring color */
}
/**
diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.ts
index 8a27ed90956..9d377a11890 100644
--- a/frontend/tailwind.config.ts
+++ b/frontend/tailwind.config.ts
@@ -109,6 +109,9 @@ export default {
tx: "transparent",
curr: "currentColor",
current: "currentColor",
+
+ contrast: "var(--color-contrast, var(--color-text))",
+ "focus-ring": "var(--color-focus-ring, var(--color-border-focus))",
},
placeholderColor: {
default: "var(--color-text-secondary)",
@@ -254,6 +257,7 @@ export default {
"over-dark": "var(--color-text-over-dark)",
"over-negative": "var(--color-text-over-negative)",
"secondary-over-dark": "var(--color-text-secondary-over-dark)",
+ contrast: "var(--color-contrast, var(--color-text))",
},
backgroundColor: {
default: "var(--color-bg)",
@@ -360,7 +364,7 @@ export default {
item,
(value) => ({
"--tw-ring-offset-color": "var(--color-bg-curr-page)",
- "--tw-ring-color": value,
+ "--tw-ring-color": `var(--color-accent, var(${value}))`,
"--tw-outline-color": value,
}),
])