Skip to content

Commit

Permalink
Merge pull request #4775 from nextcloud-libraries/feat/ncActios-focus
Browse files Browse the repository at this point in the history
feat(NcActions): focus the first action again if no action have a focus after render
  • Loading branch information
susnux authored Nov 8, 2023
2 parents 99edc27 + a432616 commit 54d47b3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/NcActions/NcActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,18 @@ export default {
return renderInlineAction(inlineActions[0])
}

// If we completely re-render the children
// we need to focus the first action again
// Mostly used when clicking a menu item
this.$nextTick(() => {
if (this.opened && this.$refs.menu) {
const isAnyActive = this.$refs.menu.querySelector('li.active') || []
if (isAnyActive.length === 0) {
this.focusFirstAction()
}
}
})

/**
* If we some inline actions to render, render them, then the menu
*/
Expand Down

0 comments on commit 54d47b3

Please sign in to comment.