-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FE] 접근성 개선 작업인 모달, 포커스, 스크린리더 개선을 진행한다. #814
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5d479b9
feat: 옵션 및 질문 접근성 개선
ooherin cd3fb13
feat: 본문 바로가기 버튼 퍼블리싱
ooherin af68da9
fix: 병합 충돌 해결
ooherin 095f483
fix: 병합 충돌 해결
ooherin 472f7c9
feat: 포커스 트랩 생성 및 모달 적용
ooherin 49c65f8
feat: 질문 선택 및 답변 aria-label 이 질문 내용 추가
ooherin f7ff7e2
feat: 탭 접근성 기능 추가
ooherin 92b867d
fix: 병합 충돌 수정
ooherin 373934e
feat: 병합 충돌 해결
ooherin 9c9825c
Merge branch 'dev-fe' of https://github.com/woowacourse-teams/2024-ba…
ooherin 579adb8
feat: 탭의 키보드 접근성 높이는 로직 추가
ooherin 1edc28a
feat: 일반 auth 폼에 엔터시 제출하는 로직 추가
ooherin 710569f
feat: 옵션 선택 접근성 수정
ooherin be38987
feat: 체크리스트 질문 편집 접근성 개선
ooherin 3d0624c
fix: 불필요한 코드 삭제
ooherin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ private* | |
test-results/ | ||
playwright-report/ | ||
blob-report/ | ||
playwright/.auth/* | ||
playwright/.cache/ | ||
*/.auth | ||
.auth | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import styled from '@emotion/styled'; | ||
import { useCallback } from 'react'; | ||
import { useCallback, useEffect, useRef } from 'react'; | ||
|
||
import TabButton from '@/components/_common/Tabs/TabButton'; | ||
import { useTabContext } from '@/components/_common/Tabs/TabContext'; | ||
|
@@ -12,29 +12,54 @@ interface Props { | |
const Tabs = ({ tabList }: Props) => { | ||
const { currentTabId, setCurrentTabId } = useTabContext(); | ||
|
||
const tabRefs = useRef<(HTMLDivElement | null)[]>([]); | ||
|
||
useEffect(() => { | ||
if (tabRefs.current[currentTabId]) { | ||
tabRefs.current[currentTabId]?.focus(); | ||
} | ||
}, [currentTabId]); | ||
|
||
const onMoveTab = useCallback( | ||
(tabId: number) => { | ||
setCurrentTabId(tabId); | ||
}, | ||
[setCurrentTabId], | ||
); | ||
|
||
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => { | ||
const currentIndex = tabList.findIndex(tab => tab.id === currentTabId); | ||
|
||
if (e.key === 'ArrowRight') { | ||
if (currentIndex === tabList.length - 1) return; | ||
const nextIndex = (currentIndex + 1) % tabList.length; | ||
setCurrentTabId(tabList[nextIndex].id); | ||
} else if (e.key === 'ArrowLeft') { | ||
if (currentIndex === 0) return; | ||
const prevIndex = (currentIndex - 1 + tabList.length) % tabList.length; | ||
setCurrentTabId(tabList[prevIndex].id); | ||
} | ||
}; | ||
|
||
return ( | ||
<S.VisibleContainer> | ||
<S.VisibleContainer role="navigation" aria-label="탭 내비게이션"> | ||
<S.Container> | ||
<S.FlexContainer> | ||
{tabList?.map(tab => { | ||
<S.FlexContainer role="tablist" onKeyDown={handleKeyDown}> | ||
{tabList?.map((tab, index) => { | ||
const { id, name, className } = tab; | ||
const isCompleted = 'isCompleted' in tab ? tab.isCompleted : undefined; | ||
|
||
return ( | ||
<TabButton | ||
ref={el => (tabRefs.current[index - 1] = el)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이렇게도 되는줄 몰랐네요 |
||
className={className} | ||
id={id} | ||
name={name} | ||
onMoveTab={onMoveTab} | ||
key={id} | ||
active={tab.id === currentTabId} | ||
tabIndex={tab.id === currentTabId ? 0 : -1} | ||
aria-selected={tab.id === currentTabId} | ||
isCompleted={isCompleted} | ||
/> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nav 태그를 사용하면 role이 자동으로 들어가기때문에 또넣어줄 필요가 없습니다.