Provider editor: multiple top plugin options overlap Models because .top caps the container at 46px
Summary
When more than one auth.options item uses placement: "top", the provider editor caps the whole options container at 46px. The options overflow it and overlap the Models section instead of pushing it down.
This is not caused by long labels or by a particular plugin: it is a class-name collision between the plugin-options container and the window header.
Affected versions / source
- Reproduced with installed Magpie 0.1.4342 on Windows/WebView2.
- Also checked current
mainatf65fe92ef93557e9a2098d2606a4d9c0175a4213; the same code is still present:internal/gui/assets/app.js:box.classList.toggle("top", !!top)inpluginOptionsField().internal/gui/assets/app.css: global.top { ... height: 46px; ... }..editor .plugin-optionssets onlygap, with no height override.
Related placement feature request: #5269.
Minimal reproduction
Declare three provider options, each with a description:
auth: {
options: [
{ key: "first", label: "First option", description: "First description", placement: "top" },
{ key: "second", label: "Second option", description: "Second description", placement: "top" },
{ key: "third", label: "Third option", description: "Third description", placement: "top" },
],
}
Open that provider's editor. The options field remains a 46px grid row, and the Models field starts before the last options have ended.
With the current 0.1.4342 embedded assets, a 1050px viewport produced:
options wrapper height: 46px
last option bottom: 485.59375px
Models section top: 370.6875px
overlap: 114.90625px
The same overlap occurs with prefers-reduced-motion both enabled and disabled.
Root cause
pluginOptionsField() adds the generic top class to the options container:
box.classList.toggle("top", !!top)
That also matches the global window-header rule:
.top {
display: flex;
align-items: center;
gap: 8px;
padding: 0 10px 0 14px;
height: 46px;
flex: none;
position: relative;
}
Consequently the options container is fixed at 46px regardless of its content.
Proposed fix
Scope the layout reset specifically to plugin options:
.editor .plugin-options.top {
height: auto;
padding: 0;
}
The more specific selector overrides the header without changing the header itself. !important is not required.
Verification of the proposed fix
I ran the current embedded Magpie assets in Chromium with three full placement: "top" options and compared getBoundingClientRect() values before and after this CSS change.
After the change:
options wrapper height: 124.734375px
last option bottom: 399.921875px
Models section top: 409.921875px
gap before Models: 10px
overlap: 0px
Both reduced-motion settings passed. The three options and their descriptions remain visible in normal document flow.
Suggested regression coverage
Add a provider-editor UI case with three top options and non-empty descriptions. Assert:
Math.max(...optionRows.map(row => row.bottom)) <= modelsRow.top
Run it for at least one wide and one narrow viewport, in Chromium and WebKit, with both reduced-motion settings. Also cover one top option and mixed top/bottom options so the original single-option behavior remains intact.
I have a fix branch ready for this issue (PRs are collaborators-only):
- Branch / Compare: https://github.com/yetone/magpie/compare/main...eisen0419:magpie:fix/7353-provider-editor-top-plugin-options
- Base:
604f707(main) · Head:20ea719(2 commits: pre-existingplugin-option-placement.test.cjsfix forRoutinginsideAdvanced, followed by the #7353 fix + regression test)
Root cause
pluginOptionsField in internal/gui/assets/app.js toggled the .top class on placement: "top" option blocks. That collided with the window title-bar rules (.top with height: 46px; align-items: center and body.window.mac .top with height: 50px; padding-left: 96px), clamping the container height so multiple options / wrapped descriptions overflowed into the Models section.
Fix & Verification
- Removed
box.classList.toggle("top", !!top)ininternal/gui/assets/app.jsso top-placed options use the standard.plugin-optionscolumn layout without affectingheader.top. - Added
internal/gui/tests/plugin-option-top-fit.test.cjs(documented ininternal/gui/tests/README.md), verified failing onorigin/mainapp.jsand passing on the fix in both Chromium and WebKit (1100px & 420px, checking option height/padding/alignment,.modelsnon-overlap, and Mac/non-Mac title-bar height). - Verified
plugin-option-top-fit.test.cjs,plugin-option-placement.test.cjs,nav-timeout.test.cjs,i18n-keys.test.cjs(77/77 passing across Chromium and WebKit) andgo test -race -count=1 -run '^TestCoreScriptBudget$' ./internal/gui.