Skip to content

Commit 666adac

Browse files
authored
added custom focus states (#784)
fixes [this](https://www.notion.so/Idol-Lead-Sync-781de97ad403492b94b420349f829ea5?pvs=4#1550ad723ce1807381f7e8df95c3d7ed) |X|Before|After| |-|-|-| |Profile card|<img width="954" alt="Screenshot 2024-12-07 at 5 05 37 PM" src="https://github.com/user-attachments/assets/a51ed831-0b66-4382-8ed2-6fd3f9331387">|<img width="954" alt="Screenshot 2024-12-07 at 5 05 27 PM" src="https://github.com/user-attachments/assets/40a589a4-5e83-4a15-8c8e-bf27b38f678e">| |Project accordion|<img width="1304" alt="Screenshot 2024-12-07 at 5 05 08 PM" src="https://github.com/user-attachments/assets/016260fb-04e9-417c-beef-bbe98ccd1f5d">|<img width="1304" alt="Screenshot 2024-12-07 at 5 04 59 PM" src="https://github.com/user-attachments/assets/d7501c76-5331-4763-a222-c04e30c460e7">| |Link|<img width="630" alt="Screenshot 2024-12-07 at 5 04 31 PM" src="https://github.com/user-attachments/assets/df94005c-7936-4d5b-afb4-873ffb393207">|<img width="630" alt="Screenshot 2024-12-07 at 5 04 21 PM" src="https://github.com/user-attachments/assets/044808ca-29b6-4f6f-8677-fcfb3ed8d3c2">| |Navbar|<img width="599" alt="Screenshot 2024-12-07 at 5 03 17 PM" src="https://github.com/user-attachments/assets/7a1656bd-4078-42c3-8160-63188784c6bc">|<img width="599" alt="Screenshot 2024-12-07 at 5 03 27 PM" src="https://github.com/user-attachments/assets/997d09fb-8667-45c4-bfca-bcbe949167f1">| |Button|<img width="593" alt="Screenshot 2024-12-07 at 5 03 01 PM" src="https://github.com/user-attachments/assets/d3cd511b-383f-4471-b126-a458e9af828e">|<img width="593" alt="Screenshot 2024-12-07 at 5 02 49 PM" src="https://github.com/user-attachments/assets/791986cf-d23f-4e48-9674-a2905fcd130a">|
1 parent 8f8ff8d commit 666adac

File tree

8 files changed

+75
-7
lines changed

8 files changed

+75
-7
lines changed

new-dti-website/components/apply/RoleDescription.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const RoleDescriptions = () => {
3434
<button
3535
onClick={() => setRole(application)}
3636
aria-label={`Show ${application} questions`}
37-
className="flex flex-col items-center gap-7"
37+
className="application-role-tab flex flex-col items-center gap-7"
3838
key={application}
3939
>
4040
<h3

new-dti-website/components/navbar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const Navbar: React.FC = () => {
5959
<div className="hidden !justify-self-end w-fit lg:inline-flex flex-row">
6060
{navbarItems.map((item) => (
6161
<a
62-
className={`hover:underline cursor-pointer text-white p-4 underline-offset-8 decoration-2 decoration-white ${
62+
className={`hover:underline cursor-pointer text-white p-4 underline-offset-8 decoration-2 decoration-white h-[48px] flex items-center ${
6363
pathname === item.url ? 'underline' : ''
6464
}`}
6565
href={item.url}

new-dti-website/components/team/MemberDisplay.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const MemberDisplay: React.FC = () => {
7676
setSelectedMember(undefined);
7777
}}
7878
aria-label={`select ${role.altText} role`}
79+
className="custom-focus-state"
7980
>
8081
<Icon
8182
icon={`${role.src}_base.svg`}

new-dti-website/components/team/MemberGroup.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export const MemberDetails: React.FC<MemberDetailsProps> = (props: MemberDetails
207207
</div>
208208
<button
209209
onClick={props.onClose}
210-
className="cursor-pointer h-min"
210+
className="cursor-pointer h-min rounded-md"
211211
aria-label="Close member details"
212212
>
213213
<Image src="/icons/close.svg" width={23} height={23} alt="" className="m-2 xs:w-4" />
@@ -317,7 +317,7 @@ const MemberGroup: React.FC<MemberGroupProps> = ({
317317
<>
318318
<button
319319
onClick={() => onMemberCardClick(member)}
320-
className="memberCard"
320+
className="memberCard custom-focus-state"
321321
aria-label={`open ${member.firstName} ${member.lastName}'s details`}
322322
>
323323
<MemberCard
@@ -354,7 +354,7 @@ const MemberGroup: React.FC<MemberGroupProps> = ({
354354
<>
355355
<button
356356
onClick={() => onMemberCardClick(member)}
357-
className="memberCard"
357+
className="memberCard custom-focus-state"
358358
aria-label={`open ${member.firstName} ${member.lastName}'s details`}
359359
>
360360
<MemberCard

new-dti-website/components/team/TeamHero.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const TeamHero = () => {
199199
}`}
200200
>
201201
<button
202-
className="relative z-10"
202+
className="relative z-10 custom-focus-state team-carousel-button"
203203
onClick={() =>
204204
setModalShown(index === carouselIndex && width >= TABLET_BREAKPOINT)
205205
}

new-dti-website/components/ui/button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { cva } from 'class-variance-authority';
66
import { cn } from '../../lib/utils';
77

88
const buttonVariants = cva(
9-
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50',
9+
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50',
1010
{
1111
variants: {
1212
variant: {

new-dti-website/src/app/globals.css

+66
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@
186186
background-color: #d63d3d;
187187
}
188188

189+
.primary-button:focus-visible,
190+
.secondary-button--red:focus-visible {
191+
outline: 3px solid #d63d3d !important;
192+
outline-offset: 3px;
193+
border-radius: 12px;
194+
}
195+
189196
.secondary-button {
190197
color: #fefefe;
191198
background-color: black;
@@ -218,7 +225,27 @@
218225
background-color: #d63d3d;
219226
}
220227

228+
.secondary-button:focus-visible {
229+
outline: 3px solid #fefefe;
230+
outline-offset: 3px;
231+
border-radius: 12px;
232+
}
233+
234+
a:focus-visible {
235+
outline: 3px solid #d63d3d;
236+
outline-offset: 3px;
237+
border-radius: 4px;
238+
}
239+
240+
button:focus-visible,
241+
summary:focus-visible {
242+
outline: 3px solid #d63d3d;
243+
outline-offset: 3px;
244+
transition: outline 0s;
245+
}
246+
221247
summary {
248+
border-radius: 8px;
222249
padding-top: 1rem;
223250
padding-bottom: 1rem;
224251
list-style: none;
@@ -240,3 +267,42 @@ summary::after {
240267
details[open] > summary::after {
241268
rotate: 180deg;
242269
}
270+
271+
.custom-focus-state:focus-visible {
272+
outline: none;
273+
position: relative;
274+
}
275+
276+
.custom-focus-state:focus-visible::after {
277+
content: '';
278+
width: calc(100% + 75px);
279+
height: 123px;
280+
top: -50px;
281+
left: -37px;
282+
border-radius: 8px;
283+
position: absolute;
284+
outline: 3px solid #d63d3d;
285+
}
286+
287+
.memberCard:focus-visible::after {
288+
width: 100%;
289+
height: 100%;
290+
top: 0;
291+
left: 0;
292+
border-radius: 8px;
293+
}
294+
295+
.application-role-tab {
296+
border-radius: 8px;
297+
}
298+
299+
.team-carousel-button {
300+
position: static;
301+
}
302+
303+
.team-carousel-button:focus-visible::after {
304+
height: 317px;
305+
width: calc(100% + 26px);
306+
left: -13px;
307+
border-radius: 16px;
308+
}

new-dti-website/src/app/page.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const Home: React.FC = () => {
100100
<div className="flex xs:justify-center lg:justify-normal items-center gap-2 z-10 lg:min-h-[100px] xs:min-h-[45px] scale-75 lg:scale-100">
101101
{icons.map((icon, index) => (
102102
<button
103+
className="rounded-md"
103104
onClick={() => {
104105
setSelectedIcon(index);
105106
if (timer) clearTimeout(timer);

0 commit comments

Comments
 (0)