summaryrefslogtreecommitdiff
path: root/packages/integrations/image/components/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/image/components/index.ts')
-rw-r--r--packages/integrations/image/components/index.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/integrations/image/components/index.ts b/packages/integrations/image/components/index.ts
index 89d8edd03..6a8f420ad 100644
--- a/packages/integrations/image/components/index.ts
+++ b/packages/integrations/image/components/index.ts
@@ -11,3 +11,17 @@ export type HTMLAttributes = Omit<
astroHTML.JSX.HTMLAttributes,
'client:list' | 'set:text' | 'set:html' | 'is:raw'
>;
+
+let altWarningShown = false;
+
+export function warnForMissingAlt() {
+ if (altWarningShown === true) { return }
+
+ altWarningShown = true;
+
+ console.warn(`\n[@astrojs/image] "alt" text was not provided for an <Image> or <Picture> component.
+
+A future release of @astrojs/image may throw a build error when "alt" text is missing.
+
+The "alt" attribute holds a text description of the image, which isn't mandatory but is incredibly useful for accessibility. Set to an empty string (alt="") if the image is not a key part of the content (it's decoration or a tracking pixel).\n`);
+}