Skip to content
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

fix(nested): don't toggle disabled children #20962

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

johnleider
Copy link
Member

fixes #20386

Description

Markup:

<template>
  <pre>{{ JSON.stringify(model, null, 2) }}</pre>
  <v-treeview
    v-model="model"
    :items="items"
    select-strategy="classic"
    item-props
    open-all
    selectable
  />
</template>

<script>
  export default {
    data: () => ({
      model: [],
      items: [
        {
          value: 1,
          id: 1,
          title: 'Applications :',
          disabled: false,
          children: [
            {
              value: 2,
              id: 2,
              title: 'Calendar : app',
              disabled: false,
              children: [
                { value: 12, id: 12, title: 'Calendar : app2', disabled: false },
                { value: 13, id: 13, title: 'Chrome : app2', disabled: true },
                { value: 14, id: 14, title: 'Webstorm : app2', disabled: false },
              ],
            },
            { value: 3, id: 3, title: 'Chrome : app', disabled: false },
            { value: 4, id: 4, title: 'Webstorm : app', disabled: false },
          ],
        },
      ],
    }),
  }
</script>

@johnleider johnleider self-assigned this Feb 5, 2025
@johnleider johnleider added this to the v3.7.x milestone Feb 5, 2025
@johnleider johnleider force-pushed the fix/20386-treeview-disabled-children-selection branch from 32e0f5c to 1f71398 Compare February 5, 2025 23:03
@KaelWD
Copy link
Member

KaelWD commented Feb 6, 2025

Wondering if this should be indeterminate instead, not all the children are actually selected.

Screenshot_20250206_165921

3.8 adds select-strategy="trunk" which is classic with a different out function, does that need to account for this too?

@@ -731,5 +765,51 @@ describe('selectStrategies', () => {
['6', 'on'],
]))
})

it('should not select disabled children when parent is selected', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return-object is usually vulnerable when nested composable has changes, so probably better add a test case to cover return-object as well

@johnleider
Copy link
Member Author

Wondering if this should be indeterminate instead, not all the children are actually selected.

I fiddled with this and was ultimately unsuccessful in getting the clicked on element that has the disabled children to default to the indeterminate state.

@johnleider johnleider added T: bug Functionality that does not work as intended/expected E: nested Nested composable labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E: nested Nested composable T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.7.0] VTreeView - Disabled items selected when parent item is selected
3 participants