Skip to content

Commit 65e145b

Browse files
committed
improve focus states and keyboard navigation for organization switcher and user settings dropdown
1 parent d2b6368 commit 65e145b

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

resources/js/Components/OrganizationSwitcher.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ const switchToTeam = (organization: Organization) => {
4040

4141
<template>
4242
<DropdownMenu v-if="page.props.jetstream.hasTeamFeatures">
43-
<DropdownMenuTrigger class="w-full text-left">
44-
<div
45-
data-testid="organization_switcher"
46-
class="flex hover:bg-white/10 cursor-pointer transition pl-2 py-1 rounded w-full items-center justify-between">
43+
<DropdownMenuTrigger
44+
class="flex w-full text-left hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-ring cursor-pointer transition pl-2 py-1 rounded w-full items-center justify-between"
45+
as-child>
46+
<button data-testid="organization_switcher">
4747
<div class="flex flex-1 space-x-2 items-center w-[calc(100%-30px)]">
4848
<div
4949
class="rounded bg-blue-900 font-medium text-xs flex-shrink-0 text-white w-5 h-5 flex items-center justify-center">
@@ -58,7 +58,7 @@ const switchToTeam = (organization: Organization) => {
5858
<ChevronDownIcon class="w-4 sm:w-full mt-[1px]"></ChevronDownIcon>
5959
</div>
6060
</div>
61-
</div>
61+
</button>
6262
</DropdownMenuTrigger>
6363

6464
<DropdownMenuContent align="start">

resources/js/Components/UserSettingsIcon.vue

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,41 +48,16 @@ const openFeedback = () => {
4848
<template>
4949
<div class="relative">
5050
<DropdownMenu>
51-
<DropdownMenuTrigger>
52-
<template v-if="page.props.jetstream.managesProfilePhotos">
53-
<button
54-
data-testid="current_user_button"
55-
class="flex text-sm border-2 outline-none border-transparent rounded-full focus:border-gray-300 transition">
56-
<img
57-
class="h-8 w-8 rounded-full object-cover"
58-
:src="page.props.auth.user.profile_photo_url"
59-
:alt="page.props.auth.user.name" />
60-
</button>
61-
</template>
62-
<template v-else>
63-
<span class="inline-flex rounded-md">
64-
<button
65-
type="button"
66-
class="inline-flex outline-none items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150">
67-
{{ page.props.auth.user.name }}
68-
69-
<svg
70-
class="ms-2 -me-0.5 h-4 w-4"
71-
xmlns="http://www.w3.org/2000/svg"
72-
fill="none"
73-
viewBox="0 0 24 24"
74-
stroke-width="1.5"
75-
stroke="currentColor">
76-
<path
77-
stroke-linecap="round"
78-
stroke-linejoin="round"
79-
d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
80-
</svg>
81-
</button>
82-
</span>
83-
</template>
51+
<DropdownMenuTrigger
52+
class="flex text-sm border-2 outline-none border-transparent rounded-full focus-visible:ring-2 focus-visible:ring-ring transition"
53+
as-child>
54+
<button data-testid="current_user_button">
55+
<img
56+
class="h-8 w-8 rounded-full object-cover"
57+
:src="page.props.auth.user.profile_photo_url"
58+
:alt="page.props.auth.user.name" />
59+
</button>
8460
</DropdownMenuTrigger>
85-
8661
<DropdownMenuContent align="center" class="min-w-40">
8762
<DropdownMenuLabel>Manage Account</DropdownMenuLabel>
8863

0 commit comments

Comments
 (0)