fix(dashboard): FAB shortcut opens add modal directly on target page
After navigating to tasks/calendar/shopping/notes via FAB, the page's primary add-button is programmatically clicked so the new-item modal opens without a second tap. FAB container right-margin doubled to avoid overlap with the browser's edge-swipe gesture zone.
This commit is contained in:
@@ -471,6 +471,14 @@ function initFab(container, signal) {
|
||||
const fabBackdrop = container.querySelector('#fab-backdrop');
|
||||
if (!fabMain) return;
|
||||
|
||||
// "Neu"-Button-Selector auf der jeweiligen Zielseite
|
||||
const FAB_NEW_BTN = {
|
||||
'/tasks': '#btn-new-task',
|
||||
'/calendar': '#fab-new-event',
|
||||
'/shopping': '#fab-new-item',
|
||||
'/notes': '#fab-new-note',
|
||||
};
|
||||
|
||||
let open = false;
|
||||
|
||||
function toggleFab(force) {
|
||||
@@ -489,7 +497,12 @@ function initFab(container, signal) {
|
||||
fabMain.addEventListener('click', (e) => { e.stopPropagation(); toggleFab(); });
|
||||
|
||||
fabActions.querySelectorAll('[data-route]').forEach((el) => {
|
||||
const go = () => { toggleFab(false); window.oikos.navigate(el.dataset.route); };
|
||||
const go = async () => {
|
||||
toggleFab(false);
|
||||
await window.oikos.navigate(el.dataset.route);
|
||||
const btnSelector = FAB_NEW_BTN[el.dataset.route];
|
||||
if (btnSelector) document.querySelector(btnSelector)?.click();
|
||||
};
|
||||
el.addEventListener('click', go);
|
||||
el.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); go(); }
|
||||
|
||||
@@ -934,7 +934,7 @@
|
||||
.fab-container {
|
||||
position: fixed;
|
||||
bottom: calc(var(--nav-bottom-height) + 24px + var(--safe-area-inset-bottom));
|
||||
right: var(--space-4);
|
||||
right: calc(var(--space-4) * 2);
|
||||
z-index: calc(var(--z-nav) - 1);
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
|
||||
Reference in New Issue
Block a user