File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ export const Modal = (args) => ({
1212 DsfrButton,
1313 } ,
1414 data ( ) {
15- return { ...args }
15+ return {
16+ ...args ,
17+ actions : args . actions . map ( action => ( { ...action , onClick : args . onClick } ) ) ,
18+ }
1619 } ,
1720 template : `
1821 <div :data-rf-theme="dark ? 'dark' : ''" style="background-color: var(--w); padding: 1rem;">
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ export default {
2222
2323 data () {
2424 return {
25- close : () => this .$emit (' close' ),
25+ closeIfEscape : ($event ) => {
26+ if ($event .key === ' Escape' ) {
27+ this .close ()
28+ }
29+ },
2630 }
2731 },
2832
@@ -36,11 +40,15 @@ export default {
3640
3741 methods: {
3842 startListeningToEscape () {
39- document .addEventListener (' keydown' , this .close )
43+ document .addEventListener (' keydown' , this .closeIfEscape )
4044 },
4145
4246 stopListeningToEscape () {
43- document .removeEventListener (' keydown' , this .close )
47+ document .removeEventListener (' keydown' , this .closeIfEscape )
48+ },
49+
50+ close () {
51+ this .$emit (' close' )
4452 },
4553 },
4654}
You can’t perform that action at this time.
0 commit comments