fix(notification): replace view-all anchor with button to prevent iframe navigation #552

Merged
marcel merged 5 commits from feat/issue-545-notification-dropdown-iframe-fix into main 2026-05-12 18:56:14 +02:00
2 changed files with 25 additions and 6 deletions
Showing only changes of commit bc2dd3a98a - Show all commits

View File

@@ -14,7 +14,7 @@ type Props = {
let { notifications, onMarkRead, onMarkAllRead, onClose }: Props = $props();
function handleViewAll() {
onClose();
onClose(); // close first — avoids stale dropdown during navigation transition
goto('/aktivitaeten');
}
</script>
@@ -135,8 +135,9 @@ function handleViewAll() {
<div class="border-t border-line px-4 py-2">
<button
type="button"
role="link"
onclick={handleViewAll}
class="text-xs font-medium text-ink-2 transition-colors hover:text-ink"
class="min-h-[44px] px-1 text-xs font-medium text-ink-2 transition-colors hover:text-ink"
>
{m.chronik_view_all()}
</button>

View File

@@ -159,7 +159,7 @@ describe('NotificationDropdown', () => {
expect(onMarkAllRead).toHaveBeenCalledOnce();
});
it('calls onClose when the view-all button is clicked', async () => {
it('calls onClose when the view-all link is clicked', async () => {
const onClose = vi.fn();
render(NotificationDropdown, {
props: {
@@ -170,12 +170,12 @@ describe('NotificationDropdown', () => {
}
});
await page.getByRole('button', { name: /alle aktivitäten|view all/i }).click();
await page.getByRole('link', { name: /alle aktivitäten|view all/i }).click();
expect(onClose).toHaveBeenCalledOnce();
});
it('navigates to /aktivitaeten when the view-all button is clicked', async () => {
it('navigates to /aktivitaeten when the view-all link is clicked', async () => {
render(NotificationDropdown, {
props: {
notifications: [],
@@ -185,11 +185,29 @@ describe('NotificationDropdown', () => {
}
});
await page.getByRole('button', { name: /alle aktivitäten|view all/i }).click();
await page.getByRole('link', { name: /alle aktivitäten|view all/i }).click();
expect(goto).toHaveBeenCalledWith('/aktivitaeten');
});
it('calls onClose before navigating to /aktivitaeten', async () => {
const callOrder: string[] = [];
const onClose = vi.fn(() => callOrder.push('close'));
(goto as ReturnType<typeof vi.fn>).mockImplementation(() => callOrder.push('goto'));
render(NotificationDropdown, {
props: {
notifications: [],
onMarkRead: () => {},
onMarkAllRead: () => {},
onClose
}
});
await page.getByRole('link', { name: /alle aktivitäten|view all/i }).click();
expect(callOrder).toEqual(['close', 'goto']);
});
it('renders MENTION items with the mention verb text', async () => {
render(NotificationDropdown, {
props: {