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 df03cdc
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
@@ -6,7 +6,7 @@ export default {
...mapGetters('Files', ['activeFilesCount'])
},
methods: {
accessibleBreadcrumb_focusAndAnnounceBreadcrumb() {
accessibleBreadcrumb_focusAndAnnounceBreadcrumb(setFocus) {
const activeBreadcrumb = last(
document.getElementById('files-breadcrumb').children[0].children
)
@@ -29,7 +29,9 @@ export default {
invisibleHint.innerHTML = translatedHint

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

0 comments on commit df03cdc

Please sign in to comment.