Skip to content

Commit 194696c

Browse files
committed
Remove unnecessary additionl focus restoration logic in add-video-prompt
1 parent e7647c0 commit 194696c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/renderer/components/ft-playlist-add-video-prompt/ft-playlist-add-video-prompt.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default defineComponent({
4444
doSearchPlaylistsWithMatchingVideos: false,
4545
updateQueryDebounce: function() {},
4646
lastShownAt: Date.now(),
47-
lastActiveElement: null,
4847
sortBy: SORT_BY_VALUES.LatestUpdatedFirst,
4948
}
5049
},
@@ -205,15 +204,13 @@ export default defineComponent({
205204
},
206205
},
207206
mounted: function () {
208-
this.lastActiveElement = document.activeElement
209207
this.updateQueryDebounce = debounce(this.updateQuery, 500)
210208
document.addEventListener('keydown', this.keyboardShortcutHandler)
211209
// User might want to search first if they have many playlists
212210
nextTick(() => this.$refs.searchBar.focus())
213211
},
214212
beforeDestroy() {
215213
document.removeEventListener('keydown', this.keyboardShortcutHandler)
216-
nextTick(() => this.lastActiveElement?.focus())
217214
},
218215
methods: {
219216
hide: function () {

src/renderer/components/ft-prompt/ft-prompt.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent } from 'vue'
1+
import { defineComponent, nextTick } from 'vue'
22
import { mapActions } from 'vuex'
33
import FtCard from '../../components/ft-card/ft-card.vue'
44
import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue'
@@ -54,10 +54,6 @@ export default defineComponent({
5454
return sanitizeForHtmlId(this.label)
5555
}
5656
},
57-
beforeDestroy: function () {
58-
document.removeEventListener('keydown', this.closeEventFunction, true)
59-
this.lastActiveElement?.focus()
60-
},
6157
mounted: function () {
6258
this.lastActiveElement = document.activeElement
6359
this.$nextTick(() => {
@@ -71,6 +67,10 @@ export default defineComponent({
7167
this.focusItem(0)
7268
})
7369
},
70+
beforeDestroy: function () {
71+
document.removeEventListener('keydown', this.closeEventFunction, true)
72+
nextTick(() => this.lastActiveElement?.focus())
73+
},
7474
methods: {
7575
click: function (value) {
7676
this.$emit('click', value)

0 commit comments

Comments
 (0)