Let the theme be chosen by clicking its label in the profile menu

Clicking a theme option's text moved focus nowhere, and the focusout rule
closed the panel before the radio was checked. The panel now closes only
when focus moves to an element outside it; clicks outside and Escape still
close it. Each theme option is a full-width row with a hover state, and
the chosen one is also shown in bold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-25 06:36:52 +02:00
co-authored by Claude Opus 5.5
parent 8aead06972
commit 4f926c238b
2 changed files with 14 additions and 3 deletions
+10
View File
@@ -27,6 +27,16 @@ it('opens and closes the profile menu with the keyboard', function () {
->assertScript('document.activeElement.hasAttribute("data-profile-menu")', true);
});
it('chooses the theme by clicking the text of an option', function () {
visit(route('customers.index'))->inLightMode()
->click(PROFILE_MENU)
->click('#profile-menu-panel label:has([data-theme-option="dark"])')
->assertScript('document.documentElement.classList.contains("dark")', true)
->assertChecked('[data-theme-option="dark"]')
->assertAttribute(PROFILE_MENU, 'aria-expanded', 'true')
->assertVisible('#profile-menu-panel');
});
it('changes the language from the profile menu', function () {
$page = visit(route('customers.index'))->inLightMode()
->click(PROFILE_MENU)