diff --git a/.changeset/cool-walls-burn.md b/.changeset/cool-walls-burn.md
new file mode 100644
index 000000000000..4f3bc4ec82a4
--- /dev/null
+++ b/.changeset/cool-walls-burn.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes rendering of the `popover` attribute when it has a boolean value
diff --git a/packages/astro/src/runtime/server/render/util.ts b/packages/astro/src/runtime/server/render/util.ts
index 1d1b1e17bfa2..711ff7020d17 100644
--- a/packages/astro/src/runtime/server/render/util.ts
+++ b/packages/astro/src/runtime/server/render/util.ts
@@ -115,6 +115,11 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the
return markHTMLString(` ${key}`);
}
+ // We cannot add it to htmlBooleanAttributes because it can be: boolean | "auto" | "manual"
+ if (key === 'popover' && typeof value === 'boolean') {
+ return markHTMLString(value ? ` popover` : '');
+ }
+
return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
}
diff --git a/packages/astro/test/astro-attrs.test.js b/packages/astro/test/astro-attrs.test.js
index 287298c938ba..14a2f09dfe80 100644
--- a/packages/astro/test/astro-attrs.test.js
+++ b/packages/astro/test/astro-attrs.test.js
@@ -16,6 +16,10 @@ describe('Attributes', async () => {
const $ = cheerio.load(html);
const attrs = {
+ 'popover-auto': { attribute: 'popover', value: 'auto' },
+ 'popover-true': { attribute: 'popover', value: '' },
+ 'popover-false': { attribute: 'popover', value: undefined },
+ 'popover-string-empty': { attribute: 'popover', value: '' },
'boolean-attr-true': { attribute: 'allowfullscreen', value: '' },
'boolean-attr-false': { attribute: 'allowfullscreen', value: undefined },
'boolean-attr-string-truthy': { attribute: 'allowfullscreen', value: '' },
diff --git a/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro b/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro
index 8f2576650f62..84a373910af5 100644
--- a/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro
+++ b/packages/astro/test/fixtures/astro-attrs/src/pages/index.astro
@@ -1,3 +1,8 @@
+
+
+
+
+