-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(NcActions): focus the first action again if no action have a focus after render #4775
Conversation
…us after render Signed-off-by: John Molakvoæ <[email protected]>
ae3fc11
to
a432616
Compare
Works here, but for the files app you need to make sure that the focus after clicking "back" is set to the "set reminder" entry and not the first one. (So that after clicking back your focus in on the entry you clicked to open then menu). vokoscreenNG-2023-11-08_10-04-40.mp4Meaning in this example, after pressing "back" "show menu" should be focused not "edit". |
This is a different topic then
I personally vote for |
@skjnldsv yes 2 probably. For the text app this is currently done like that (we use submenus there too so we also needed to fix it). Thats why I wrote it works here but for apps you need to manually keep track of menu changes. <template>
<NcActions>
<template v-if="!showMenu">
<NcActionButton @click="showMessage('Edit')">Edit</NcActionButton>
<NcActionButton ref="menuToggle" :is-menu="true" @click="showMenu = true">Show menu</NcActionButton>
</template>
<template v-else>
<NcActionButton key="menu-1" @click="handleClose">< Back</NcActionButton>
<NcActionButton key="menu-2" @click="showMessage('Edit')">Second entries</NcActionButton>
<NcActionButton key="menu-3" @click="showMessage('Delete')">Second entries</NcActionButton>
</template>
</NcActions>
</template>
<script>
export default {
data() {
return {
showMenu: false,
}
},
methods: {
showMessage(msg) {
alert(msg)
},
handleClose() {
this.showMenu = false
// Required on this PR to prevent focusing the first entry
this.$nextTick(() => this.$refs.menuToggle.$el.classList.add('active'))
// here some inner ref would be great to prevent using getElementsByTagName
this.$nextTick(() => this.$refs.menuToggle.$el.getElementsByTagName('button')[0].focus())
}
},
}
</script> Looks like this then: vokoscreenNG-2023-11-08_10-29-51.mp4 |
A bit simpler :) |
From nextcloud/server#41010 (review)
Testing in preview ⬈