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

fix: Dialog 背景に z-index を追加 #4910

Merged
merged 2 commits into from
Sep 11, 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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const Action_Dialog: StoryFn = () => {
aria-haspopup="dialog"
aria-controls="dialog-action"
data-test="dialog-trigger"
// 別のスタッキングコンテキストがダイアログ背景よりも上に来ないことを確認するための記述
style={{ position: 'relative', zIndex: 21 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

[ask]

マジックナンバーで良いです?軽く調べただけですが、一応テーマには z-index 定義があったので、ちゃんと強弱関係管理できるように変数化されてるのかなぁと気になりました。

export const defaultZIndex = {
AUTO: 'auto',
DEFAULT: 0,
FIXED_MENU: 100,
OVERLAP_BASE: 10000,
OVERLAP: 10500,
FLASH_MESSAGE: 11000,
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

基本的には z-index: 1 で済むところを、Bootstrap などが使わている旧環境のために大きな値を使っている認識なので Story 上でプロダクトを疑似再現するマジックナンバーで良いと考えています。
Dialog の戻した z-index は定義値を使っています。

>
ActionDialog
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const Default: StoryFn = () => {
aria-haspopup="dialog"
aria-controls="dialog-default"
data-test="dialog-trigger"
// 別のスタッキングコンテキストがダイアログ背景よりも上に来ないことを確認するための記述
style={{ zIndex: 21, position: 'relative' }}
>
Dialog
</Button>
Expand Down Expand Up @@ -188,6 +190,8 @@ export const Form_Dialog: StoryFn = () => {
aria-haspopup="dialog"
aria-controls="dialog-form"
data-test="dialog-trigger"
// 別のスタッキングコンテキストがダイアログ背景よりも上に来ないことを確認するための記述
style={{ position: 'relative', zIndex: 21 }}
>
FormDialog
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = PropsWithChildren<

const dialogOverlap = tv({
base: [
'shr-absolute shr-inset-0',
'shr-absolute shr-inset-0 shr-z-overlap-base',
'[&.shr-dialog-transition-enter]:shr-opacity-0',
'[&.shr-dialog-transition-enter-active]:shr-transition-opacity',
'[&.shr-dialog-transition-enter-active]:shr-duration-300',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export const Message_Dialog: StoryFn = () => {
aria-haspopup="dialog"
aria-controls="dialog-message"
data-test="dialog-trigger"
// 別のスタッキングコンテキストがダイアログ背景よりも上に来ないことを確認するための記述
style={{ position: 'relative', zIndex: 21 }}
>
MessageDialog
</Button>
Expand Down