Files
wekan/tests/cardOverHeaderStacking.test.cjs
T
Lauri Ojansivu 006d24502c The opened card covers the header bar on an iPad: the header drops to the content's level.
On iPad Chrome and Safari (both WebKit) the opened card's top row - the collapse
caret, the card number, the menu, maximize and X - was behind the header bar,
although the card has z-index 2001 and the header 1000. iOS WebKit makes every
scrolling element (#content, the board wrapper) a stacking context of its own, so
the card's z-index is compared only inside it while the header bar, a flex item of
body and a stacking context too, is painted over all of it. While a card is open
the header bar (#header-quick-access) is now at z-index 0, the level of the
content, which comes after it in the page and so paints over it; with no card open
it keeps 1000.

A browser spec makes #content and the board wrapper stacking contexts with
isolation: isolate, which is the same trap, and shows the card over the header open
and collapsed, its close button reachable, in Chromium and WebKit; without the rule
it fails with the card's top at 8 behind a header 88 high, as in the screenshot.

Thanks to xet7 !
2026-11-04 02:56:33 +02:00

42 lines
2.3 KiB
JavaScript

'use strict';
// The opened card covers the header bar on an iPad. iOS WebKit (iPad Safari and Chrome)
// makes every scrolling element a stacking context, so the card's z-index is compared
// only inside #content, and the header bar (#header-quick-access, z-index 1000, a flex
// item of body) was painted over the card's top row. While a card is open the header
// drops to the level of the content. tests/playwright/specs/card-over-header-ios-stacking
// .e2e.js simulates the trap and shows it in a browser.
//
// Run: node tests/cardOverHeaderStacking.test.cjs
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const { test } = require('node:test');
const read = rel => fs.readFileSync(path.join(__dirname, '..', rel), 'utf8');
const header = read('client/components/main/header.css');
test('while a card is open the header bar is at the level of the content', () => {
assert.match(header, /body:has\(\.card-details\) #header-quick-access \{\n z-index: 0;\n\}/);
// negative: it is conditional - the header keeps 1000 when no card is open
assert.match(header, /\n#header-quick-access \{[^}]*z-index: 1000;/);
assert.doesNotMatch(header.replace(/body:has\(\.card-details\) #header-quick-access \{\n z-index: 0;\n\}/, ''), /#header-quick-access \{[^}]*z-index: 0;/);
});
test('it names the header that exists: #header-quick-access, not the old #header', () => {
const rule = /body:has\(\.card-details\) (#[\w-]+)/.exec(header);
assert.equal(rule[1], '#header-quick-access');
assert.ok(read('client/components/main/header.jade').includes('#header-quick-access'), 'the template draws it');
// the card's own level is above the header's normal one, so a browser without the trap needs nothing
const card = read('client/components/cards/cardDetails.css');
assert.match(card, /body\.desktop-mode \.card-details:not\(\.card-details-popup\) \{[^}]*z-index: 2001;/);
});
test('the content is the later sibling that paints over the header at the same level', () => {
// #content comes after the header in the page and is positioned, so at z-index 0 against 0
// it is painted last, which is what puts the card over the header's second row as well.
const layouts = read('client/components/main/layouts.css');
assert.match(layouts, /\n#content \{\n position: relative;\n flex: 1;/);
});