-
-
Notifications
You must be signed in to change notification settings - Fork 33
feat(user): implement drag and drop #83
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds drag-and-drop functionality for rearranging items in the web interface. Key changes include the introduction of drag event handlers in the script, updating the HTML template to include a draggable attribute and a drag handle, and styling adjustments to indicate a dragging element.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| web/script.js | Added the initDragAndDrop function with drag event listeners. |
| web/index.html | Updated the URL template to mark items as draggable and styled the drag handle. |
| }, | ||
| initDragAndDrop() { | ||
| const list = document.querySelector('#urls .list-group'); | ||
|
|
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a check to verify that the 'list' element exists before binding drag event listeners, to prevent potential runtime errors if the element is missing.
| if (!list) { | |
| console.warn("Element '#urls .list-group' not found. Drag-and-drop functionality will not be initialized."); | |
| return; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this.
|
|
||
| <template id="template-url"> | ||
| <li class="list-group-item text-truncate fs-3"> | ||
| <li class="list-group-item text-truncate fs-3" draggable="true"> |
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding ARIA attributes (e.g., aria-grabbed) to this draggable element to improve accessibility for keyboard and assistive technology users.
| <li class="list-group-item text-truncate fs-3" draggable="true"> | |
| <li class="list-group-item text-truncate fs-3" draggable="true" aria-grabbed="false" role="listitem" aria-dropeffect="move"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional, if you want to add.
debloper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 thanks!
Will need to test it out on a device before merging the PR.
The title says it all I guess. I needed to be able to drag-drop the items in de webinterface, so I've added that in a simple way. Hopefully you can add it to your repo as well so other users can benefit from it.