Skip to content

Commit 3a18715

Browse files
sserrataclaude
andcommitted
fix(theme): close schema expansion popover on scroll
Repositioning the popover during scroll lagged behind the trigger and felt detached. Close the popover instead so it always appears anchored at the moment of opening. Also revert the tooltip text to its original "Schema expansion depth". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a1a0149 commit 3a18715

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • packages/docusaurus-theme-openapi-docs/src/theme/SchemaExpansion

packages/docusaurus-theme-openapi-docs/src/theme/SchemaExpansion/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ const SchemaExpansionControl: React.FC = () => {
6666
useLayoutEffect(() => {
6767
if (!open) return;
6868
updatePosition();
69-
window.addEventListener("scroll", updatePosition, true);
69+
const handleScroll = () => setOpen(false);
70+
window.addEventListener("scroll", handleScroll, true);
7071
window.addEventListener("resize", updatePosition);
7172
return () => {
72-
window.removeEventListener("scroll", updatePosition, true);
73+
window.removeEventListener("scroll", handleScroll, true);
7374
window.removeEventListener("resize", updatePosition);
7475
};
7576
}, [open, updatePosition]);
@@ -110,7 +111,7 @@ const SchemaExpansionControl: React.FC = () => {
110111
const levels = Array.from({ length: config.max + 1 }, (_, i) => i);
111112
const buttonLabel = translate({
112113
id: "theme.openapi.schema.expansion.button",
113-
message: "Set how deep schemas auto-expand",
114+
message: "Schema expansion depth",
114115
description: "Aria/title tooltip for the schema expansion icon button",
115116
});
116117
const allLabel = translate({

0 commit comments

Comments
 (0)