fix(ux): prevent iOS auto-zoom on inputs + lazy-load page CSS
Increase font-size to 16px on mobile for shopping quick-add inputs, notes search, and contacts search. Desktop breakpoint restores compact sizes. Move 9 page-specific stylesheets from index.html to on-demand loading in router.js, reducing initial CSS payload.
This commit is contained in:
+29
-1
@@ -64,6 +64,31 @@ function updateThemeColorForRoute(route) {
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Dynamisches Stylesheet-Loading pro Seitenmodul
|
||||
// --------------------------------------------------------
|
||||
let activePageStyle = null;
|
||||
|
||||
function loadPageStyle(moduleName) {
|
||||
if (!moduleName) return Promise.resolve();
|
||||
const href = `/styles/${moduleName}.css`;
|
||||
if (activePageStyle?.getAttribute('href') === href) return Promise.resolve();
|
||||
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = href;
|
||||
|
||||
const loaded = new Promise((resolve) => {
|
||||
link.onload = resolve;
|
||||
link.onerror = resolve;
|
||||
});
|
||||
|
||||
if (activePageStyle) activePageStyle.remove();
|
||||
document.head.appendChild(link);
|
||||
activePageStyle = link;
|
||||
return loaded;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Modul-Cache: verhindert redundante dynamic imports bei Navigation
|
||||
// --------------------------------------------------------
|
||||
@@ -170,7 +195,10 @@ async function renderPage(route, previousPath = null) {
|
||||
if (loading) loading.hidden = true;
|
||||
|
||||
try {
|
||||
const module = await importPage(route.page);
|
||||
const [module] = await Promise.all([
|
||||
importPage(route.page),
|
||||
loadPageStyle(route.module),
|
||||
]);
|
||||
|
||||
if (typeof module.render !== 'function') {
|
||||
throw new Error(`Seite ${route.page} exportiert keine render()-Funktion.`);
|
||||
|
||||
Reference in New Issue
Block a user