Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): keep the install tabs off the modal title

Yudhi Armyndharis54dacf0489fa
diff --git a/dashboard/src/pages/Plugins.css b/dashboard/src/pages/Plugins.css
index 7f639d2f8..28a115ffd 100644
--- a/dashboard/src/pages/Plugins.css
+++ b/dashboard/src/pages/Plugins.css
@@ -837,21 +837,30 @@
}
/* When the tabs sit INSIDE the install modal header (between the title and the close button), drop
- the standalone-row margins so they don't push the title up / leave a gap. Pin them to the true
- horizontal center of the header with absolute positioning — justify-content:space-between only
- centers them approximately because the title (left) and close button (right) have different widths,
- leaving the pill visibly off-center. The header carries position:relative so this is self-contained. */
+ the standalone-row margins so they don't push the title up / leave a gap. On a narrow viewport they
+ take a row of their own under the title and the close button (flex-wrap on the header). */
.plugins-page .install-modal .modal-header .install-tabs {
margin: 0;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
+ order: 3;
+ width: 100%;
+}
+
+/* Where the header has room beside the longest title, pin the tabs to its true horizontal center with
+ absolute positioning: justify-content:space-between only centers them approximately because the
+ title (left) and close button (right) have different widths, leaving the pill visibly off-center. An
+ absolutely positioned box takes no part in wrapping, so below this width it would cover the title. */
+@media (min-width: 700px) {
+ .plugins-page .install-modal .modal-header .install-tabs {
+ order: 0;
+ width: auto;
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ }
}
-/* Three-item header (title + tabs + close). Position:relative anchors the absolutely-centered pill;
- flex-wrap keeps it from overflowing horizontally on a narrow viewport (mobile bottom-sheet width),
- wrapping to a second row instead. */
+/* Three-item header (title + tabs + close). Position:relative anchors the absolutely-centered pill. */
.plugins-page .install-modal .modal-header {
position: relative;
flex-wrap: wrap;
diff --git a/dashboard/src/pages/Plugins.responsive.test.ts b/dashboard/src/pages/Plugins.responsive.test.ts
new file mode 100644
index 000000000..d49e834a3
--- /dev/null
+++ b/dashboard/src/pages/Plugins.responsive.test.ts
@@ -0,0 +1,24 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { decl, readRules } from '../test-helpers/css-rules.ts';
+
+const rules = readRules(new URL('./Plugins.css', import.meta.url));
+
+// The Upload/Catalog pill in the install modal header. Centred with absolute positioning it takes no part in
+// flex-wrap, so on a phone it was drawn over the title ("Insta" and a tab). It is centred only where the header
+// has room beside the longest translated title, and takes a row of its own below that.
+const PILL = '.plugins-page .install-modal .modal-header .install-tabs';
+
+test('the install tabs are centred over the header only on wide screens', () => {
+ const centred = rules.filter(r => r.selectors.includes(PILL) && decl(r.body, 'position') === 'absolute');
+ assert.equal(centred.length, 1, 'expected one rule that pins the pill');
+ assert.equal(centred[0].media, '@media (min-width: 700px)');
+});
+
+test('below that the install tabs wrap to a row of their own', () => {
+ const base = rules.find(r => r.selectors.includes(PILL) && !r.media);
+ assert.ok(base, 'no base rule for the pill');
+ assert.equal(decl(base.body, 'position'), undefined);
+ assert.equal(decl(base.body, 'width'), '100%');
+ assert.equal(decl(base.body, 'order'), '3');
+});