-
Notifications
You must be signed in to change notification settings - Fork 178
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
Move to react-photo-album
#10463
Move to react-photo-album
#10463
Conversation
Oh neat, thanks for picking this up! So this is really mostly a drop-in replacement, which is great! Curious, would the columns layout perhaps work too and cause the same results? Then we might not need to specify Also, is there any noticeable performance improvement by any chance? |
Sadly no.
Using it seems similar but it does break unit tests in |
Since you changed/removed the mock in the unit test we now have to mock |
Sure. Let me just push my changes to fix |
Looks like you're on the right track. Just need to make similar change to (note: while at it, can also rename the file from |
3 items in a row isn't a big deal, but those large ones on a single line don't look great. Maybe we should indeed try the columns option to see if that works better. Let's play a little bit with the config options. |
packages/story-editor/src/components/library/panes/media/common/mediaGallery.js
Show resolved
Hide resolved
packages/story-editor/src/components/library/panes/media/common/mediaGallery.js
Outdated
Show resolved
Hide resolved
Let's not decide too quickly.
Doesn't it have accessibility considerations because items are now laid out differently? (in columns instead of rows) Let's please test combinations of various settings first before changing from rows (which we have always used) to columns |
I tried a number of different layouts to see what looks best. It is true, that the row layout is as similar the currently layout. But it doesn't mean we can't use column / masonry. We may want to do this in a follow up PR. LayoutsRow layout, row height 150masonry layout, columns 2column layout, columns 2 |
It is also worth noting that accessibility / keyboard navigation seems to be an issue in both column and row based layouts. I tried using keyboard navigation in both layouts, pressing arrows left and right, resulted in just going up and down in column layout and opposite in row layout. Row layoutScreen.Recording.2022-02-07.at.11.31.02.movColumn layoutScreen.Recording.2022-02-07.at.11.35.23.mov |
v 1.7.0 of |
packages/story-editor/src/components/library/panes/media/common/mediaGallery.js
Outdated
Show resolved
Hide resolved
@ayushnirwal This is amazing! At first I was like "this is a very timely update" and then I realized you made the change. Thanks a bunch! 🎉 At first glance it looks really promising. With |
@swissspidy do you still see this issue? |
No I don't! No stretched images or videos here. |
Apologies for jumping in here, but may I suggest you move custom renderers (including the |
Thanks for the suggestion, it's greatly appreciated! |
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.
This looks pretty good now!
@swissspidy Looks like some new Karma tests are failing since this PR (at least didn't see these before when checking commits on
And some others. Since these are related to images then seem like valid failures. |
I could swear I checked Kama, not sure how I missed that 🤔 I'll look into it, but probably not today. If you have a spare moment to briefly run them locally to see whee they fail, that'd be helpful. Thanks! |
At least this is failing locally as well: The Quick Actions tests mentioned above passed locally (but fail on the PRs). I've actually also mostly finished for today so wouldn't have time to check it in more detail until Monday. |
Apparently what all the failing tests have in common is that they try dragging a media library item to the edge of the canvas to set it as the bg. And that doesn't work anymore. I can confirm that drop-targets are not (reliably?) working in the editor when dragging straight from the media library. @miina You know that code well, perhaps something comes to mind? |
Hm, I can actually see it working reliably locally 🤔 Is it sometimes working and sometimes not in your case? |
It wouldn't work when
|
Weird, at first it didn't work at all, but now it seems just fine reliably. Still not working in Karma tests though. This is the relevant bit: web-stories-wp/packages/story-editor/src/components/dropTargets/karma/order.karma.js Lines 47 to 56 in 928311c
|
Would be great to inspect the elements in DOM in Karma tests while the cursor is above a media item to see if the Perhaps it's possible to take a snapshot at that moment and then inspect the source locally? |
Ah, actually -- do you know if it's about the drop-targets not working or about the element not being dragged at all? |
This reverts commit 5d35d80.
In local tests the element is being dragged just fine. But it looks like the issue here is that the web-stories-wp/packages/story-editor/src/components/library/panes/media/common/innerElement.js Lines 115 to 132 in 7fc8dfe
|
Context
Previously react-photo-gallery was used to display media elements in the library pane, it has not seen any change since 1 July 2019. Therefore it was stuck at React version
^16.8.0
which will cause 2 versions of React to be installed if are packages published.Summary
Documentation lacked any explanation of related to the props passed to
renderPhoto
( analogous torenderImage
inreact-photo-gallery
). So below is an example of its props.react-photo-album
`react-photo-gallery ( previously used )

Relevant Technical Choices
photo
obj since there was no info about that inrenderPhotos
's propstargetRowHeight
was set to150
to make the end result similar.react-photo-album
inMedia3pPane
unit test suite.To-do
User-facing changes
Testing Instructions
This PR can be tested by following these steps:
Reviews
Does this PR have a security-related impact?
Does this PR change what data or activity we track or use?
Does this PR have a legal-related impact?
Checklist
Type: XYZ
label to the PRFixes #10444