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

[Data Views] Enhance UX and Add drag and drop ordering for Filter properties and table column #66981

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Mayank-Tripathi32
Copy link
Contributor

What?

This PR addresses issue #66611. It implements the initial design mockup provided and adds drag-and-drop functionality to the property list. Additionally, it includes basic CSS adjustments for visual consistency and utilizes available icons for improved UI clarity.

Why?

This update enhances the user experience by allowing easier reordering of properties in the list through drag-and-drop functionality. It also improves UI consistency, aligning with the design specifications outlined in the mockup and leveraging existing icons to maintain visual coherence. This change aims to streamline interactions with the property list and increase usability.

How?

This implementation leverages React's built-in hooks to achieve drag-and-drop functionality. It combines JavaScript event handlers—onDragStart, onDrop, and onDragOver—with useState for managing component state dynamically. Additionally, useRef is utilized alongside setDragImage to render a preview of the row during dragging.

To keep the solution simple and lightweight, no external libraries were used, ensuring minimal dependencies and improved maintainability.

Testing Instructions

  1. Navigate to the Site Editor: Go to Pages, then select "Table" View from Layout.
  2. Open "View Options" and Start Dragging a Property: Click and hold on any item in the property list to initiate the drag. Ensure that a preview of the item appears as you drag.
  3. Drag and Drop: Move the item to a new position in the list and release it to drop. Verify that the item is repositioned correctly in the new location, check dragging between hidden state and visible.
  4. Check State Persistence: After reordering, confirm that the updated order is reflected in the list and that the component state is maintained correctly.
  5. Cross-Browser Compatibility: Test the drag-and-drop functionality across multiple browsers (e.g., Chrome, Firefox, Safari) to ensure consistent behavior.
  6. Responsiveness: Verify that the drag-and-drop feature works as expected on various screen sizes, including desktops, tablets, and mobile devices.
  7. Edge Cases:
    • Empty List: Confirm the UI handles an empty list without errors.
    • Single Item: Check if dragging a single item does not cause unexpected behavior.
    • Rapid Reordering: Quickly drag and reorder items to test stability under rapid interactions.
  8. Accessibility: Confirm that the drag-and-drop feature is accessible, ensuring keyboard navigation and screen reader compatibility where applicable.
  9. Visual Consistency: Verify that all icons and CSS changes appear as intended and match the mockup design, while using the existing icons.

Screenshots

image

demo.mp4

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mayank-Tripathi32 <mayanktripathi32@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 13, 2024
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Mayank-Tripathi32! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant