File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -55,14 +55,29 @@ export default {
55
55
},
56
56
57
57
watch: {
58
- isVisible: ' focusFirst'
58
+ isVisible (val ) {
59
+ this .managePrevFocusElement (val)
60
+ this .focusFirst (val)
61
+ }
59
62
},
60
63
61
64
mounted () {
65
+ this .managePrevFocusElement (this .isVisible )
62
66
this .focusFirst (this .isVisible )
63
67
},
64
68
69
+ beforeDestroy () {
70
+ this .managePrevFocusElement (false )
71
+ },
72
+
65
73
methods: {
74
+ managePrevFocusElement (visible ) {
75
+ if (! visible && window .vflPrevFocusedElement ) {
76
+ return window .vflPrevFocusedElement .focus ()
77
+ }
78
+ window .vflPrevFocusedElement = document .activeElement
79
+ },
80
+
66
81
getFocusableElements () {
67
82
const focusableElements = this .$refs .focusLoop .querySelectorAll (focusableElementsSelector)
68
83
if (focusableElements && focusableElements .length ) return focusableElements
You can’t perform that action at this time.
0 commit comments