fix(modal): compensate scrollbar width when locking page scroll

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-28 21:07:27 +08:00
1 parent fcec5b996f
commit 5dd7d14334
3 files changed
+52 -3

No files matched your search

@@ -0,0 +1,15 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const root = path.resolve(__dirname, '../..');
const runtime = fs.readFileSync(path.join(root, 'assets/js/core/modal-runtime.js'), 'utf8');
test('modal runtime compensates the removed scrollbar like Bootstrap setScrollbar', () => {
assert.match(runtime, /var gap = window\.innerWidth - html\.clientWidth;/);
assert.match(runtime, /scrollLock\.push\(padRight\(body, gap\)\)/);
assert.match(runtime, /var SCROLLBAR_FIXED = "\.nav-fixed \.header, \.float-right";/);
assert.match(runtime, /entry\.element\.style\.paddingRight = entry\.inline;/);
assert.doesNotMatch(runtime, /classList\.toggle\("aksrt-modal-runtime-open"/);
});