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

feat: add modal button aria label and export ModalCloseButton #550

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

yue4u
Copy link
Contributor

@yue4u yue4u commented Jun 3, 2024

やったこと

  • add closeButtonAriaLabel for Modal and aria-hidden for pixiv-icon inside.
  • rename and export ModalCloseButton

Before:
Screenshot 2024-06-02 at 23 22 15

After:

Screenshot 2024-06-02 at 23 21 58

動作確認環境

チェックリスト

不要なチェック項目は消して構いません

  • 破壊的変更がある場合には、対象のパッケージのメジャーバージョンが上がっていることを確認した
  • 追加したコンポーネントが index.ts から再 export されている
  • README やドキュメントに影響があることを確認した

@yue4u yue4u changed the title fix: modal button aria label feat: add modal button aria label and export ModalCloseButton Jun 3, 2024
@@ -74,6 +75,7 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(function ModalInner(
onClose,
className,
isOpen = false,
closeButtonAriaLabel = 'Close',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

make this a prop for i18n

@@ -224,7 +228,7 @@ const ModalBackground = animated(styled.div<{
}
`)

const ModalCrossButton = styled(IconButton)`
export const ModalCloseButton = styled(IconButton)`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case user want to set isDismissable to false and handle it themselves, for example, pass different onClose for close button and background.

@@ -36,7 +36,7 @@ const IconButton = forwardRef<ClickableElement, IconButtonProps>(
$variant={variant}
$isActive={isActive}
>
<pixiv-icon name={icon} />
<pixiv-icon aria-hidden="true" name={icon} />
Copy link
Contributor Author

@yue4u yue4u Jun 3, 2024

Choose a reason for hiding this comment

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

This changes all IconButtons. If it's too broad to decide I'll make this a separate PR.

@yue4u yue4u force-pushed the fix/modal-button-aria-label branch from e4d7a5a to 02037a7 Compare June 3, 2024 01:48
@mimokmt mimokmt added the minor label Jun 3, 2024
@mimokmt mimokmt self-requested a review June 3, 2024 05:35
@mimokmt mimokmt merged commit b9c0708 into pixiv:main Jun 4, 2024
12 of 13 checks passed
@yue4u yue4u deleted the fix/modal-button-aria-label branch June 5, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants