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

fix(datalist): use drag-over modifier instead of css style #5119

Merged
merged 1 commit into from
Feb 3, 2021
Merged

fix(datalist): use drag-over modifier instead of css style #5119

merged 1 commit into from
Feb 3, 2021

Conversation

boaz0
Copy link
Member

@boaz0 boaz0 commented Nov 11, 2020

What: Closes #5041

//cc @mcoker

@patternfly-build
Copy link
Contributor

patternfly-build commented Nov 11, 2020

@@ -326,12 +326,10 @@ export class DataList extends React.Component<DataListProps, DataListState> {
isCompact && styles.modifiers.compact,
gridBreakpointClasses[gridBreakpoint],
wrapModifier && styles.modifiers[wrapModifier],
dragging && styles.modifiers.dragOver,
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good to replace the existing behavior, but I think we need to change it so that styles.modifiers.dragOver is only applied while dragging, meaning it's removed once the item is dropped.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the dragging state needs to be updated in the drag end handler, it is removed properly on a drag cancel. It should work with that updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

As @kmcfaul mentioned. dragging is a part of the DataList state which is being updated to true in dragStart0 and false in onDragCancel. These two are being called accordingly to the events when the user clicks and holds the element or releases the element.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should also be updated in dragEnd0 so the style gets removed when the drag is successfully completed.

@tlabaj
Copy link
Contributor

tlabaj commented Dec 7, 2020

@boaz It looks like there are outstanding comments here.

@tlabaj
Copy link
Contributor

tlabaj commented Jan 7, 2021

@boaz0 this one still has outstanding comments.

@boaz0
Copy link
Member Author

boaz0 commented Jan 9, 2021

@tlabaj sorry, I thought I fixed it. I will work on it.
Thanks.

@codecov-io
Copy link

codecov-io commented Jan 9, 2021

Codecov Report

Merging #5119 (033200a) into master (c26b549) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5119      +/-   ##
==========================================
- Coverage   51.91%   51.90%   -0.02%     
==========================================
  Files         579      579              
  Lines       11272    11275       +3     
  Branches     4184     4184              
==========================================
  Hits         5852     5852              
- Misses       4683     4686       +3     
  Partials      737      737              
Flag Coverage Δ
patternfly4 51.90% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...es/react-core/src/components/DataList/DataList.tsx 24.36% <0.00%> (-0.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09dadb2...033200a. Read the comment docs.

kmcfaul
kmcfaul previously approved these changes Jan 18, 2021
tlabaj
tlabaj previously approved these changes Jan 19, 2021
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

lgtm

@mcoker
Copy link
Contributor

mcoker commented Jan 19, 2021

Looking at this draggable example, I'm still seeing .pf-m-drag-over on the data list after I've stopped dragging.

@boaz0
Copy link
Member Author

boaz0 commented Jan 21, 2021

Um, maybe I am missing something. But this is what I have on Firefox.

movie.mp4

@mcoker
Copy link
Contributor

mcoker commented Jan 21, 2021

@boaz0 ah ok, I was testing in chrome - this is what I'm seeing

Jan-21-2021.09-17-01.mp4

@boaz0
Copy link
Member Author

boaz0 commented Jan 21, 2021

Thanks @mcoker I will look at this more. 😆

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
@boaz0 boaz0 dismissed stale reviews from tlabaj and kmcfaul via 033200a January 28, 2021 10:42
@boaz0
Copy link
Member Author

boaz0 commented Jan 28, 2021

@mcoker do you mind review this again. I hope this fixes the problem.

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.

LGTM!!

Copy link
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

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

lgtm!

@kmcfaul kmcfaul merged commit f7c5c27 into patternfly:master Feb 3, 2021
@boaz0 boaz0 deleted the closes_5041 branch February 3, 2021 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Class to fix data list shifting when rows are dragged
6 participants