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 - DragDropSort - dragged element transform inaccruate when DragDropSort is in DrawerPanelContent #10090

Closed
jennydaman opened this issue Feb 16, 2024 · 0 comments · Fixed by #10283
Assignees
Milestone

Comments

@jennydaman
Copy link

Describe the problem

I combined the examples for Drag and Drop and Drawer with very few modifications:

import React from 'react';
import {
  Drawer,
  DrawerPanelContent,
  DrawerContent,
  DrawerContentBody,
  DrawerHead,
  DrawerActions,
  DrawerCloseButton,
  Button
} from '@patternfly/react-core';
import {DragDropSort, DraggableObject} from "@patternfly/react-drag-drop";

export const DrawerInlinePanelStart: React.FunctionComponent = () => {
  const [isExpanded, setIsExpanded] = React.useState(true);
  const drawerRef = React.useRef<HTMLDivElement>();

  const onExpand = () => {
    drawerRef.current && drawerRef.current.focus();
  };

  const onClick = () => {
    setIsExpanded(!isExpanded);
  };

  const onCloseClick = () => {
    setIsExpanded(false);
  };

  const [items, setItems] = React.useState<DraggableObject[]>([
    { id: 'with-button-1', content: 'one' },
    { id: 'with-button-2', content: 'two' },
    { id: 'with-button-3', content: 'three' },
    { id: 'with-button-4', content: 'four' },
    { id: 'with-button-5', content: 'five' },
    { id: 'with-button-6', content: 'six' },
    { id: 'with-button-7', content: 'seven' },
    { id: 'with-button-8', content: 'eight' },
    { id: 'with-button-9', content: 'nine' },
    { id: 'with-button-10', content: 'ten' },
    { id: 'with-button-11', content: 'eleven' },
    { id: 'with-button-12', content: 'twelve' },
    { id: 'with-button-13', content: 'thirteen' },
    { id: 'with-button-14', content: 'fourteen' },
    { id: 'with-button-15', content: 'fifteen' },
    { id: 'with-button-16', content: 'sixteen' },
    { id: 'with-button-17', content: 'seventeen' },
    { id: 'with-button-18', content: 'eighteen' },
    { id: 'with-button-19', content: 'nineteen' },
    { id: 'with-button-20', content: 'twenty' },
  ]);

  const panelContent = (
    <DrawerPanelContent>
      <DrawerHead>
        <span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
          drawer content
        </span>
        <DrawerActions>
          <DrawerCloseButton onClick={onCloseClick} />
        </DrawerActions>
      </DrawerHead>
      <DragDropSort
        items={items}
        variant="defaultWithHandle"
        onDrop={(_, newItems) => {
          setItems(newItems);
        }}
      />
    </DrawerPanelContent>
  );

  const drawerContent =
    'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';

  return (
    <React.Fragment>
      <Button aria-expanded={isExpanded} onClick={onClick}>
        Toggle drawer
      </Button>
      <Drawer isExpanded={isExpanded} isInline position="start" onExpand={onExpand}>
        <DrawerContent panelContent={panelContent}>
          <DrawerContentBody>{drawerContent}</DrawerContentBody>
        </DrawerContent>
      </Drawer>
    </React.Fragment>
  );
};


export default DrawerInlinePanelStart;

How do you reproduce the problem?

https://github.com/jennydaman/patternfly-react-drag-drop-in-drawer

Expected behavior

Dragged element stays under the mouse.

Is this issue blocking you?

It is blocking us from using the Drag and Drop feature, but I can choose to use a different UX instead.

Screenshots

simplescreenrecorder-2024-02-16_15.55.34.mp4

What is your environment?

  • OS: Linux
  • Browser Chromium, Firefox
  • Version 5.2.0
@jennydaman jennydaman added the bug label Feb 16, 2024
@github-project-automation github-project-automation bot moved this to Needs triage in PatternFly Issues Feb 16, 2024
@tlabaj tlabaj moved this from Needs triage to Backlog in PatternFly Issues Feb 26, 2024
@tlabaj tlabaj added this to the Prioritized Backlog milestone Feb 26, 2024
@adamviktora adamviktora moved this from Backlog to Not started in PatternFly Issues Apr 15, 2024
@adamviktora adamviktora moved this from Not started to In Progress in PatternFly Issues Apr 16, 2024
@adamviktora adamviktora moved this from In Progress to PR Review in PatternFly Issues Apr 17, 2024
@tlabaj tlabaj modified the milestones: Prioritized Backlog, 2024.Q2 Apr 17, 2024
@github-project-automation github-project-automation bot moved this from PR Review to Done in PatternFly Issues Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants