Skip to content

Commit

Permalink
fix(playground): ignore keyboard events in template messages for drag…
Browse files Browse the repository at this point in the history
… and drop (#4945)

* fix(playground): ignore keyboard events in template messages for drag and drop

* pull default pointer sensor from dnd-kit/dom

* update file name casing via git

* migrate to non-experimental dnd-kit

* remove unused experimental code, update naming and remove unnecessary props

* remove strategy

* fix forward ref warning
  • Loading branch information
Parker-Stafford authored and mikeldking committed Oct 11, 2024
1 parent 240bfe8 commit 2b6529f
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 315 deletions.
5 changes: 3 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"@codemirror/lang-python": "6.1.3",
"@codemirror/lint": "^6.8.1",
"@codemirror/view": "^6.28.5",
"@dnd-kit/abstract": "^0.0.5",
"@dnd-kit/react": "^0.0.5",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@react-three/drei": "^9.108.4",
"@react-three/fiber": "8.0.12",
"@tanstack/react-table": "^8.19.3",
Expand Down
91 changes: 38 additions & 53 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions app/src/components/dnd/DragHandle.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import React from "react";
import { DraggableAttributes } from "@dnd-kit/core";
import { css } from "@emotion/react";

function DragHandle() {
// This is the type of the listeners object from useSortable
// However it is not exported from @dnd-kit/core so we have to redefine it here
// eslint-disable-next-line @typescript-eslint/ban-types
type Listeners = Record<string, Function>;

function DragHandle(
{
listeners,
attributes,
}: {
listeners?: Listeners;
attributes: DraggableAttributes;
},
ref: React.Ref<HTMLButtonElement>
) {
return (
<button
data-cypress="draggable-handle"
ref={ref}
{...listeners}
{...attributes}
aria-roledescription="draggable"
aria-pressed="false"
aria-disabled="false"
Expand Down
208 changes: 0 additions & 208 deletions app/src/components/dnd/helpers/move.ts

This file was deleted.

Loading

0 comments on commit 2b6529f

Please sign in to comment.