Skip to content

Commit 54d47b3

Browse files
authored
Merge pull request #4775 from nextcloud-libraries/feat/ncActios-focus
feat(NcActions): focus the first action again if no action have a focus after render
2 parents 99edc27 + a432616 commit 54d47b3

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/components/NcActions/NcActions.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,18 @@ export default {
11751175
return renderInlineAction(inlineActions[0])
11761176
}
11771177
1178+
// If we completely re-render the children
1179+
// we need to focus the first action again
1180+
// Mostly used when clicking a menu item
1181+
this.$nextTick(() => {
1182+
if (this.opened && this.$refs.menu) {
1183+
const isAnyActive = this.$refs.menu.querySelector('li.active') || []
1184+
if (isAnyActive.length === 0) {
1185+
this.focusFirstAction()
1186+
}
1187+
}
1188+
})
1189+
11781190
/**
11791191
* If we some inline actions to render, render them, then the menu
11801192
*/

0 commit comments

Comments
 (0)