Skip to content
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] 접근성 개선 : 지출내역 추가 Flow의 Top #758

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/components/Design/components/Top/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function Line({text, emphasize = []}: Props) {
size="subTitle"
textColor={emphasize.includes(text) ? 'black' : 'gray'}
style={{whiteSpace: 'pre'}}
aria-hidden={true}
>
{`${text}`}
</Text>
Expand Down
10 changes: 10 additions & 0 deletions client/src/components/Design/components/Top/Top.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsxImportSource @emotion/react */
import {css} from '@emotion/react';
import React from 'react';

import Line from './Line';
import EditableLine from './EditableLine';
Expand All @@ -8,12 +9,21 @@ Top.Line = Line;
Top.EditableLine = EditableLine;

export default function Top({children}: React.PropsWithChildren) {
const childrenTexts: string[] = [];
React.Children.forEach(children, child => {
if (React.isValidElement(child) && child.type === Top.Line) {
childrenTexts.push(child.props.text);
}
});

return (
<div
css={css`
display: flex;
flex-direction: column;
`}
aria-label={childrenTexts.join(' ')}
tabIndex={0}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 div에 tab focus를 주기 위해 tabIndex=0을 주신 건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞습니당! tabIndex가 존재하지 않으면 Top 컴포넌트 전체에 스크린리더가 포커스가 안 가더라구요

>
{children}
</div>
Expand Down
Loading