Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Add breakpoint based modal variations #1272

Merged
merged 7 commits into from
May 3, 2022
Merged

Conversation

sarayourfriend
Copy link
Contributor

@sarayourfriend sarayourfriend commented Apr 14, 2022

Fixes

Fixes #522 by @panchovm
Fixes #1375 by @AetherUnbound

Description

Updates the existing modal implementation to add breakpoint-based variations. It's just style updates except that the mobile version also includes the logo button. I added that because the only place we actually currently use the modal is for the mobile filters and search type switcher and those use the logo button in the header.

This does also wrap the top bar in a slot to make it easier to modify the modal content without having to copy/paste the whole thing like we've done with the VMobileModalContent.

This PR also removes that component 🎉

Testing Instructions

Checkout the branch and run pnpm dev to visit the site locally.

Go to the search results page with a small viewport width and verify that the modal for the search type switcher and the filters still works as expected and that it looks good.

Next run pnpm storybook and open the Modal story in storybook and test out the various breakpoints using Storybook's breakpoints option or by opening the iframe popout and changing your viewport width manually (the second option can give you a sense of how responsive it is).

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@openverse-bot openverse-bot added 🌟 goal: addition Addition of new feature 🕹 aspect: interface Concerns end-users' experience with the software 🟨 priority: medium Not blocking but should be addressed soon labels Apr 14, 2022
@sarayourfriend sarayourfriend marked this pull request as ready for review April 14, 2022 10:31
@sarayourfriend sarayourfriend requested a review from a team as a code owner April 14, 2022 10:31
@sarayourfriend sarayourfriend requested review from krysal and obulat April 14, 2022 10:31
@fcoveram
Copy link

It looks great so far. I just noticed two things that maybe you are currently working on.

Modal scroll

When I scroll down, the white area where content is placed remains fixed while the internal content moves up and down. I think the best approach is how Unsplash and Rawpixel solved this. Go and search for something since pasting a URL from both sites takes you to the non-modal version of the single result view.

Modal width

The modal widths for breakpoints 2xl and xl work well, but while changing the viewport manually, I notice the width changes as the page view increases or decreases. I think we should keep the modal width fixed until reaching a different breakpoint. In that way, the content placed inside does not move too much and the modal is always center aligned.

In breakpoints lg and md, the modal width is smaller than the Design Libary mockup. For lg it should be 768px while for md should be full width (768px). Below two screenshots of what I am seeing.

Screenshots

lg md
CleanShot 2022-04-14 at 16 13 26@2x CleanShot 2022-04-14 at 16 13 10@2x

@sarayourfriend
Copy link
Contributor Author

Okay, I didn't understand the mock-ups correctly, I will update it, it's just a matter of moving the widths up one breakpoint.

When I scroll down, the white area where content is placed remains fixed while the internal content moves up and down. I think the best approach is how Unsplash and Rawpixel solved this. Go and search for something since pasting a URL from both sites takes you to the non-modal version of the single result view.

How would we implement that behavior with the close button where it is, above the modal? It would scroll out of view 🤔

@fcoveram
Copy link

I do not think that being out of view when scrolling down is terrible as it is consistent with all breakpoints and the back to results. On the other hand, the escape button can work for closing the modal.

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

I really like the clean-up of the Modal components :)

@sarayourfriend sarayourfriend force-pushed the add/modal-breakpoints branch from a116085 to 36d9308 Compare April 25, 2022 06:21
@sarayourfriend
Copy link
Contributor Author

@panchovm widths are updated, let me know if they're correct now (I'm having a hard time fully understanding the mock-ups and how they relate to the space between the breakpoints, in particular the space between the sm and md breakpoints. I took a guess, but let me know if it makes sense.

I also updated it so that it scrolls the full modal overlay rather than just the modal body, as you requested.

@fcoveram
Copy link

Modal behavior

I run dev and it does not look like a modal but like page that keeps the openverse header fixed. Here is a screenshot.

Non-scroll Scroll
CleanShot 2022-04-25 at 11 23 00@2x CleanShot 2022-04-25 at 11 24 05@2x

Close area

In md I am seeing the close action outside the modal, whereas in sm and xs the close area has the same close area as the content switcher/filters content. The logic you are following is fine as it is consistent across all content displayed as full-size, but the design proposes a "back to results" top-left button.

I am considering requesting an update of Close modal component to have a close area for modals, content switcher and filters, and header scrolled version. Here is a screenshot of how it might look like.

CleanShot 2022-04-25 at 11 32 13@2x

Let me know what you think

@sarayourfriend
Copy link
Contributor Author

@panchovm Sorry, there is some confusion. This does not implement the "results open as a modal" behavior, it just updates the modal to behave appropriately for each breakpoint (a necessary step for the results as a modal PR).

When we implement the "results as a modal" PR, we will replace the top bar with the "back to search results" as indicated in the designs. This is easily possible now due to some internal implementation changes I made in this PR as well.

Basically this PR sets us up for implementing the search result modal (so long as we can sort out the browser navigation difficulties, but that's a technical implementation detail, not something you need to worry about 😁)

@fcoveram
Copy link

Perfect. Thanks for the clarification. The dev work looks great then ✨

@sarayourfriend sarayourfriend requested a review from obulat April 28, 2022 06:52
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

Looks nice, and the code is much cleaner.
You cannot open a modal twice, but I guess it's being worked on in #1279?

@sarayourfriend
Copy link
Contributor Author

@obulat yes, that's going to be a doozy for another PR. I think I will have to re-write the whole dialog composable ☹️ There's some very weird circular event handling that I'm not understanding at all.

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

These look great, and such a clean approach to fixing the issue. I still see a vertical 1px (!!) shift in the logo when opening the menu, which I tried to debug but was unsuccessful. It's a major improvement regardless.

@sarayourfriend sarayourfriend merged commit dbdce24 into main May 3, 2022
@sarayourfriend sarayourfriend deleted the add/modal-breakpoints branch May 3, 2022 01:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🌟 goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Openverse logo shifts when opening filter sidebar Modal versions for breakpoints
5 participants