From de5132356111ef3dccbe08be3c5b7f3585f0e0d4 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Tue, 9 Feb 2021 02:26:39 +0300 Subject: [PATCH] Fix search for elements on current route path --- src/views/settings/index.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index 7c5d0434..cc31d76a 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -159,10 +159,18 @@ export default { const tab = Object.keys(this.tabs).find(tab => { return this.tabs[tab].settings.includes(selectedValue.group === ':pleroma' ? selectedValue.key : selectedValue.group) }) - if (tab) { + if (this.$router.currentRoute.path === `/settings/${tab}`) { + this.scrollTo(selectedValue.key) + } else if (tab) { this.$router.push({ path: `/settings/${tab}` }) } }, + scrollTo(searchQuery) { + const selectedSetting = document.querySelector(`[data-search="${searchQuery}"]`) + if (selectedSetting) { + selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' }) + } + }, querySearch(queryString, cb) { const results = this.searchData.filter(searchObj => searchObj.search.find(el => el.includes(queryString.toLowerCase()))) .map(searchObj => {