chore(ui): remove fomantic's dimmer module (#7416)

- Fomantic's dimmer module is responsible for dimming the page and make some element the primary focus on the page (e.g. modal). This module is only used by Fomantic's modal module.
- Remove it and replace the javascript with our own `Dimmer` class that is able to provide Fomantic's modal module with everything it needs.
- Replace the CSS with our own bare minimum CSS.
- No functionality or visual is affected by this replacement.
- E2E test added.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7416
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-04-02 12:54:54 +00:00 committed by Gusted
parent d656978818
commit f691f03741
9 changed files with 109 additions and 1116 deletions

View file

@ -0,0 +1,39 @@
// @watch start
// templates/shared/user/**
// web_src/css/modules/dimmer.ts
// web_src/css/modules/dimmer.css
// @watch end
import {expect} from '@playwright/test';
import {save_visual, test} from './utils_e2e.ts';
test.use({user: 'user2'});
test('Dimmed modal', async ({page}) => {
await page.goto('/user1');
await expect(page.locator('.block')).toContainText('Block');
// Ensure the modal is hidden
await expect(page.locator('#block-user')).toBeHidden();
await page.locator('.block').click();
// Modal and dimmer should be visible.
await expect(page.locator('#block-user')).toBeVisible();
await expect(page.locator('.ui.dimmer')).toBeVisible();
await save_visual(page);
// After canceling, modal and dimmer should be hidden.
await page.locator('#block-user .cancel').click();
await expect(page.locator('.ui.dimmer')).toBeHidden();
await expect(page.locator('#block-user')).toBeHidden();
await save_visual(page);
// Open the block modal and make the dimmer visible again.
await page.locator('.block').click();
await expect(page.locator('#block-user')).toBeVisible();
await expect(page.locator('.ui.dimmer')).toBeVisible();
await expect(page.locator('.ui.dimmer')).toHaveCount(1);
await save_visual(page);
});