Skip to content

Commit

Permalink
Prevent focus from being set to breadcrumb if route changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed May 28, 2021
1 parent 7265329 commit a833900
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 4 additions & 2 deletions packages/web-app-files/src/mixins/accessibleBreadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
...mapGetters('Files', ['activeFilesCount'])
},
methods: {
accessibleBreadcrumb_focusAndAnnounceBreadcrumb() {
accessibleBreadcrumb_focusAndAnnounceBreadcrumb(sameRoute) {
const activeBreadcrumb = last(
document.getElementById('files-breadcrumb').children[0].children
)
Expand All @@ -29,7 +29,9 @@ export default {
invisibleHint.innerHTML = translatedHint

activeBreadcrumb.append(invisibleHint)
activeBreadcrumbItem.focus()
if (sameRoute) {
activeBreadcrumbItem.focus()
}
}
}
}
9 changes: 5 additions & 4 deletions packages/web-app-files/src/views/Personal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ export default {
watch: {
$route: {
handler: function() {
handler: function(to, from) {
const sameRoute = to.name === from?.name
this.checkHomeFallback()
this.loadResources()
this.loadResources(sameRoute)
},
immediate: true
},
Expand Down Expand Up @@ -184,7 +185,7 @@ export default {
}
},
async loadResources() {
async loadResources(sameRoute) {
this.loading = true
this.CLEAR_CURRENT_FILES_LIST()
Expand Down Expand Up @@ -219,7 +220,7 @@ export default {
this.adjustTableHeaderPosition()
this.loading = false
this.accessibleBreadcrumb_focusAndAnnounceBreadcrumb()
this.accessibleBreadcrumb_focusAndAnnounceBreadcrumb(sameRoute)
this.scrollToResourceFromRoute()
},
Expand Down
10 changes: 7 additions & 3 deletions packages/web-app-files/src/views/PublicFiles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ export default {
watch: {
$route: {
handler: 'loadResources',
handler: function(to, from) {
const sameRoute = to.name === from?.name
this.checkHomeFallback()
this.loadResources(sameRoute)
},
immediate: true
},
Expand All @@ -149,7 +153,7 @@ export default {
'CLEAR_CURRENT_FILES_LIST'
]),
async loadResources() {
async loadResources(sameRoute) {
this.loading = true
this.CLEAR_CURRENT_FILES_LIST()
Expand Down Expand Up @@ -204,7 +208,7 @@ export default {
}
this.loading = false
this.accessibleBreadcrumb_focusAndAnnounceBreadcrumb()
this.accessibleBreadcrumb_focusAndAnnounceBreadcrumb(sameRoute)
},
redirectToResolvePage() {
Expand Down

0 comments on commit a833900

Please sign in to comment.