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

[BUG] DropList DragFeedback item's display is not set to "none" #144

Open
Jackson-Wheeler opened this issue Aug 8, 2023 · 6 comments
Open

Comments

@Jackson-Wheeler
Copy link

Jackson-Wheeler commented Aug 8, 2023

-- Hello, I believe I found a bug, but I'm not 100% sure I'm not just doing something incorrectly. Hope this is helpful. --

Using [email protected], @vue/cli 5.0.8, [email protected], [email protected], and [email protected]
Was testing code from the following Demo: https://codesandbox.io/s/droplist-ozs8b?file=/src/App.vue (EDIT: the Demo shows the correct code. However, the code was not correct in my environment (detailed above))

Upon dragging item from the left list, the right list (drop-list) displays the DragFeedback item (class="DragFeedback __feedback") at the bottom of the DropList (see images).

Dragging item from left:
dragging

Hovering item over DropList:
inserting

After investigating the source code of the demo (linked above), it seems that "[email protected]" sets "display: none" in the style of the DragFeedback element, such that the extra feedback item does not display at the bottom of the list:

source: ".drop-list[data-v-17e16b58]>*{transition:transform .2s}.feedback[data-v-17e16b58]{display:none}.__drag-image[data-v-17e16b58]{position:fixed;top:-10000px;left:-10000px;will-change:left,top}",

Solution: I went into the source code of [email protected] and in the if statement where the DragFeedback element is created and pushed into defaultArr I added style: 'display: none', to the code. This seemingly solved the problem.

if (this.showDragFeedback) {
      defaultArr.push(h(
        script$1,
        {
          style: 'display: none', // INSERTED THIS LINE
          class: '__feedback',
          ref: 'feedback',
          key: 'drag-feedback'
        },
        {
          default: () => this.$slots['feedback']({
            type: this.dragType,
            data: this.dragData
          })[0]
        }
      ));
    }
@nicholaszuccarelli
Copy link
Collaborator

I don't see what is a bug here sorry.
The behaviour of drag feedback is quite complex because of the different states it can handle.
The extra feedback item should correctly not be displayed at the bottom of the list because it is a placeholder - they are in the process of dragging to the list but we don't know which position the user intends to place the element.
The item has been rendered invisibly in case they do drag onto the list (especially if you have multiple DropLists on a page)

@Jackson-Wheeler
Copy link
Author

Jackson-Wheeler commented Aug 9, 2023

Ah yes, that is the correct functionality. However, when I ran the code in my environment, the extra feedback item was displayed by default. The second image (titled "Hovering item over DropList") shows the problem: two feedback items are visible at the same time. (the Demo I linked has the correct functionality)

@nicholaszuccarelli
Copy link
Collaborator

Weird. I don't have any issues on my projects. Was your local environment a blank or existing project?

@Jackson-Wheeler
Copy link
Author

Here is a Demo of the problem (when dragging from top list to bottom list): https://codesandbox.io/s/dreamy-darwin-vz4qnx?file=/src/components/MyComponent.vue. Hopefully that helps.

@nicholaszuccarelli
Copy link
Collaborator

Thanks! :) I've reopened the issue.

@horodynskyi
Copy link

Hey, any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants