Skip to content

Conversation

kmcfaul
Copy link
Contributor

@kmcfaul kmcfaul commented Jun 15, 2021

What: Closes #5817

Basic dragging functionality. Keyboard interaction may have to be added in a follow-up.

@nicolethoen

Surge direct link: https://patternfly-react-add_draggable_table.surge.sh/components/table/#composable-draggable-table

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 15, 2021

@nicolethoen The onClick handler for the draggable cell isn't needed for the draggable events at this time. The problem with putting the event handlers on the drag button instead of the whole row is that the 'ghost' you see when dragging would be incorrect (seeing only the button) and the re-ordering gets a bit wonky.

I think we could update this later, maybe after revisiting the draggable implementation overall. But right now the whole row is getting dragged like in DataList. I don't think that should interfere with any control buttons in the row.

@nicolethoen
Copy link
Contributor

I know in my code i deleted all the other examples - I don't think you should do that ;)

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 15, 2021

Oh that would be bad haha. I didn't notice that. Will update the PR

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 15, 2021

Updated, hopefully. Rolled back to the commit before your initial commit from the file history then re-applied the draggable table example.

@nicolethoen
Copy link
Contributor

nicolethoen commented Jun 16, 2021

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 16, 2021

surge site?: patternfly-react-add_draggable_table.surge.sh

Yeah that does work. I'm thinking it's maybe because the branch is on the PF repo already but I'm unsure. Regardless, I'll direct link to the example at the top of the PR.

variant="plain"
className={className}
type="button"
aria-label={ariaLabel || `Draggable row draggable button`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessiehuff does this make sense for default aria-label?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jessie is out - can you think of an alternative?

Copy link
Contributor Author

@kmcfaul kmcfaul Jun 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what its worth, DataList has no default aria-label, but its example code uses "Reorder" as it's aria-label, paired with aria-labelledby with the list item id.

Edit: It also uses aria-describedby and aria-pressed but those are more tied to the keyboard interaction, which isn't in for table yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is ok to leave as is and get Jessie's feedback once she returns.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Though the parent <td> for the draggable button needs the class .pf-c-table__draggable. That will fix the button's spacing and cursor.

And core is missing a background color on the ghost row, so I put up a PR for that - patternfly/patternfly#4159

Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good @kmcfaul . I wasn't completely clear about the discussion around whether to allow the whole row of just the drag handle to be draggable. I like how this works now for this example, but could see where we might get into trouble if there were other active elements in the row. Did you say this is or isn't consistent with how data list works? I guess that the issues would be the same.

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 17, 2021

It is the same as DataList

mcarrano
mcarrano previously approved these changes Jun 17, 2021
Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good then. Thanks @kmcfaul .

tlabaj
tlabaj previously approved these changes Jun 17, 2021
nicolethoen
nicolethoen previously approved these changes Jun 17, 2021
dlabrecq
dlabrecq previously approved these changes Jun 18, 2021
@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 18, 2021

Waiting on an additional core css class for drag-over styling

@kmcfaul kmcfaul dismissed stale reviews from dlabrecq, nicolethoen, tlabaj, and mcarrano via ab4d305 June 21, 2021 14:31
@kmcfaul kmcfaul force-pushed the add_draggable_table branch from 42e9bea to ab4d305 Compare June 21, 2021 14:31
@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 21, 2021

@mcoker Updated with the new class. The pf-m-drag-over modifier is being added/removed along with the ghost row modifier.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L🔥TM!!! Fantastic work on getting this in so quickly!! 🏆🥇

Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way to go Katie!

@redallen redallen merged commit ec41040 into master Jun 21, 2021
@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

@nicolethoen nicolethoen deleted the add_draggable_table branch June 5, 2023 17:24
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

Successfully merging this pull request may close these issues.

Table: add draggable rows
8 participants