vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.32k stars 6.93k forks source link

[Feature Request] Make VListGroup selectable #19479

Open 11mad11 opened 3 months ago

11mad11 commented 3 months ago

Problem to solve

Right now, there is no way to make a VListGroup selectable. Only the leaf node are.

Hack

I tried to write a hack but this line prevent me from using the overlay of the VListItem for the background color

Proposed solution

Either make the Activator of a VListGroup selectable or offer to configure the background opacity.

websitevirtuoso commented 3 months ago

If you need to set opacity or remove it you can do this via css .v-list-groupheader.v-list-item--active &:not(:focus-visible) .v-list-itemoverlay opacity: 0

like .my_class.v-list-groupheader.v-list-item--active &:not(:focus-visible) .v-list-itemoverlay opacity: 0

YSHgroup commented 2 months ago

Hi all, I'd like to make an addition here. In my case, the VList used for VNavigationDrawer and every VListItem works as RouterLink with to props. Also, there are some cases VListGroup must work like that too. For example, When clicking the VListGroup, sub list should be dropped down and the appropriate page will be opened at the same time. So, I've tried the following way:

 <v-list-group
    :value='item.title'
  >

    <template v-slot:activator='{props}'>
      <v-list-item 
        v-bind:='props' 
        :value='item.title'
        :title='item.title' 
        :to='item.to ? item.to: undefined'
        rounded
        color='secondary'
      >

However, after that, the page reloaded while navigation works, and therefore the sub list never open.

Currently, I've implemented the functionality with other one, but also, I've left comment // TODO: To be fixed because this one doesn't follow the best practice.

Could you please let me know the best solution?