Skip to content

Commit

Permalink
Correctly send focus to edit btn in people shares
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed May 25, 2021
1 parent a1fbd67 commit 981fce6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
7 changes: 5 additions & 2 deletions changelog/unreleased/enhancement-people-focus
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Enhancement: Send focus to "Add people" btn after closing Add/Edit panels

We've started sending the focus to "Add people" button after the Add or Edit panels in the people accordion have been closed.
We've started sending the focus to "Add people" button after the `Add` panel in the people accordion has been closed.
Also, when editing a share the focus jumps back to the "Edit" button in the respective share after cancelling or
confirming the action.

https://github.com/owncloud/web/pull/5129
https://github.com/owncloud/web/pull/5129
https://github.com/owncloud/web/pull/5143
15 changes: 12 additions & 3 deletions packages/web-app-files/src/components/FileSharingSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,16 @@
v-if="$_ocCollaborators_canShare && currentPanel === PANEL_NEW"
key="new-collaborator"
@close="$_ocCollaborators_showList"
@beforeDestroy="togglCollaborator"
@mounted="togglCollaborator"
/>
<edit-collaborator
v-if="$_ocCollaborators_canShare && currentPanel === PANEL_EDIT"
key="edit-collaborator"
:collaborator="currentShare"
@close="$_ocCollaborators_showList"
@beforeDestroy="togglCollaborator"
@mounted="togglCollaborator"
/>
</div>
</template>
Expand Down Expand Up @@ -363,6 +367,14 @@ export default {
this.currentShare = share
this.SET_APP_SIDEBAR_ACCORDION_CONTEXT(PANEL_EDIT)
},
togglCollaborator(component, event) {
this.focus({
from: document.activeElement,
to: component.$el.querySelector('#files-collaborators-role-button'),
revert: event === 'beforeDestroy'
})
},
$_ocCollaborators_deleteShare(share) {
this.transitionGroupActive = true
this.deleteShare({
Expand All @@ -373,9 +385,6 @@ export default {
$_ocCollaborators_showList() {
this.SET_APP_SIDEBAR_ACCORDION_CONTEXT(PANEL_SHOW)
this.currentShare = null
this.$nextTick(() => {
this.$refs.addCollaborators.$el.focus()
})
},
$_ocCollaborators_isUser(collaborator) {
return (
Expand Down

0 comments on commit 981fce6

Please sign in to comment.