@@ -17,6 +17,7 @@ const onSwitchLocale = () => {
17
17
const { width } = useWindowSize ()
18
18
const { orientation } = useScreenOrientation ()
19
19
const shouldShowSpHeader = ref ()
20
+ const dialogRef = ref <HTMLDialogElement >()
20
21
onMounted (() => {
21
22
shouldShowSpHeader .value = width .value <= 1200
22
23
})
@@ -27,6 +28,11 @@ watch([width, orientation], () => {
27
28
const showMenu = ref (false )
28
29
29
30
const toggleMenu = () => {
31
+ if (showMenu .value ) {
32
+ dialogRef .value ! .close ()
33
+ } else {
34
+ dialogRef .value ! .show ()
35
+ }
30
36
showMenu .value = ! showMenu .value
31
37
}
32
38
@@ -48,26 +54,33 @@ const getAnchorPath = computed(
48
54
class =" navigation-mobile-toggle"
49
55
name =" menu"
50
56
:class =" { 'isOpened': showMenu }"
57
+ :aria-expanded =" showMenu"
58
+ aria-controls =" navigation-mobile-menu-trigger"
59
+ :aria-label =" showMenu ? 'メニューを閉じる' : 'メニューを開く'"
51
60
@click =" toggleMenu"
52
61
>
53
62
<span /><span /><span />
54
63
</button >
55
64
<!-- <VFIcon name="menu" color="vue-blue" can-hover @click="toggleMenu" /> -->
56
65
</div >
57
66
<!-- hamburger-menu -->
58
- <Transition name =" slide-down" >
59
- <div v-show =" showMenu" class =" navigation-mobile-menu" >
60
- <div >
61
- <ul >
62
- <li v-for =" link in navLinks" :key =" link.anchor" >
63
- <nuxt-link :to =" getAnchorPath(link.anchor)" @click =" toggleMenu" >
64
- <VFTypography variant =" heading/200" color =" vue-blue" >{{ link.text }}</VFTypography >
65
- </nuxt-link >
66
- </li >
67
- </ul >
68
- </div >
69
- </div >
70
- </Transition >
67
+ <!-- eslint-disable vuejs-accessibility/no-autofocus -->
68
+ <dialog
69
+ id =" navigation-mobile-menu-trigger"
70
+ ref =" dialogRef"
71
+ autofocus
72
+ aria-label =" ハンバーガーメニュー"
73
+ class =" navigation-mobile-menu"
74
+ >
75
+ <!-- eslint-enable vuejs-accessibility/no-autofocus -->
76
+ <ul >
77
+ <li v-for =" link in navLinks" :key =" link.anchor" >
78
+ <nuxt-link :to =" getAnchorPath(link.anchor)" @click =" toggleMenu" >
79
+ <VFTypography variant =" heading/200" color =" vue-blue" >{{ link.text }}</VFTypography >
80
+ </nuxt-link >
81
+ </li >
82
+ </ul >
83
+ </dialog >
71
84
</VFSpHeader >
72
85
<VFHeader v-else >
73
86
<div class =" navigation-pc" >
@@ -95,6 +108,7 @@ const getAnchorPath = computed(
95
108
align-items : center ;
96
109
gap : calc (var (--unit ) * 2 );
97
110
margin-right : 27px ;
111
+ z-index : 10 ;
98
112
}
99
113
100
114
.navigation-mobile-menu {
@@ -104,6 +118,22 @@ const getAnchorPath = computed(
104
118
width : 100vw ;
105
119
text-align : center ;
106
120
background-color : var (--color-white );
121
+ z-index : 1 ;
122
+
123
+ width : 100% ;
124
+ border : 0 ;
125
+ transition :
126
+ translate 0.6s cubic-bezier (0.4 , 0 , 0.2 , 1 ),
127
+ display 0.6s cubic-bezier (0.4 , 0 , 0.2 , 1 ) allow-discrete;
128
+ translate : 0 -100% ;
129
+
130
+ &[open ] {
131
+ translate : 0 0 ;
132
+
133
+ @starting-style {
134
+ translate : 0 -100% ;
135
+ }
136
+ }
107
137
108
138
& > div {
109
139
padding : calc (var (--unit ) * 5 ) 0 ;
0 commit comments