nextcloud-libraries / nextcloud-libraries/nextcloud-vue

[NcActions] Proposal: submenu support

Open
#6,066 0 comments 2 reactions 1 assignee View on GitHub

@ShGKme is already working on this.

Since Sep 9, 2024.

feature: actions
Dominant language
Vue
Stars
246
Forks
99
Avg merge
1d 20h
Merged PRs (30d)
103

Description

Currently sub menus are implemented almost manually via:

  • <template v-if>
  • <NcActionButton is-menu>

It works, but:

  • Not great in a11y, including lack of attributes and focus movement
  • Not very semantic for developers
  • Requires manual implementing of menu/submenu state, the back button

Proposal: allow to use slots for additional menus like

<NcActions>
  <template #default>
    <NcActionButton menu="foo">
      Sub-menu foo
    </NcActionButton>
  </template>
  
  <template #menu-foo>
    <!-- Content -->
  </template>
</NcActions>

So that:

  • Formal is-menu buttons actually switch to another slot (just renders other buttons)
  • We have a better separation between sub-menus
  • We can implement it internally with a11y

The only thing I don't like here, is that we still have to check for the default slot for inline buttons...

What do you think?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.