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

feat: add Popover component #373

Merged
merged 6 commits into from Mar 2, 2021
Merged

Conversation

micgro42
Copy link
Collaborator

This will be implemented across multiple subtasks of T273041.

Bug: T273041

@github-actions
Copy link

@Ladsgroup
Copy link
Contributor

It is small enough to be easily reviewed and have my blessings. If UX looks good, this can go in? (I know this is not mergable atm)

Copy link
Contributor

@bereket-WMDE bereket-WMDE left a comment

Choose a reason for hiding this comment

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

its a good baseline to continue the rest of the subtasks.
Its looks good. maybe a very very nitpicky suggestion: should we rename this.isShownData to this.isDataShown ? unless there's a reason I'm missing.

ofc, the failing tests need to be fixed. then can be approved and merged.

@micgro42
Copy link
Collaborator Author

Its looks good. maybe a very very nitpicky suggestion: should we rename this.isShownData to this.isDataShown ? unless there's a reason I'm missing.

Yeah, or .isContentShown would be an even better name

@bereket-WMDE
Copy link
Contributor

Its looks good. maybe a very very nitpicky suggestion: should we rename this.isShownData to this.isDataShown ? unless there's a reason I'm missing.

Yeah, or .isContentShown would be an even better name

I like that one

@micgro42 micgro42 force-pushed the PopoverComponent branch 7 times, most recently from 5e33729 to d7ef54c Compare February 17, 2021 16:02
@sai-san
Copy link
Collaborator

sai-san commented Feb 26, 2021

Lots of progress here! 💯

Let me suggest the following Storybook changes hoping you can tell me if you agree this would be an improvement or not. Maybe, instead of the iconOnly buttons, we could use normal buttons with text that provides some extra indications, such as:

  • In the Basic page, the button label could say "Popover trigger"
  • In the All page, the button labels could indicate the position of the popover (like in this example).
    It would also be awesome if, in that same page, the popovers were placed in an orderly fashion beyond the fold, so not so much scrolling is necessary.

I could try to do this myself in a different PR, since it doesn't impact the component. What do you think?

@sai-san
Copy link
Collaborator

sai-san commented Feb 26, 2021

Unfortunately, many of the popovers look broken in Safari:

Screenshot 2021-02-26 at 18 40 51

Top-right and bottom-right are the only two that render correctly.

@micgro42
Copy link
Collaborator Author

  • In the Basic page, the button label could say "Popover trigger"

Easily done. Will do it tomorrow.

  • In the All page, the button labels could indicate the position of the popover (like in this example).

Can do, but note that we would keep showing all the Popovers by default, to allow for visual regression tests to verify their position and appearance.

It would also be awesome if, in that same page, the popovers were placed in an orderly fashion beyond the fold, so not so much scrolling is necessary.

I agree, but that becomes tricky together with the above requirement of showing all the Popovers right from the start. Though we could probably reduce the distance between two components a bit, that should already help. And maybe change the order of the Popover-positions a bit, that should also help.

Unfortunately, many of the popovers look broken in Safari:

Yeah, we will have to look into fixing that. My suspicion is that our postcss is not translating things like inset-block-end: ... correctly into bottom: ...

@micgro42
Copy link
Collaborator Author

micgro42 commented Feb 26, 2021

In the mid-term, we may want to look into separating the storybook for visual regression tests from the storybook for public documentation.

And ideally have those visual regression tests done with all supported browsers, not just with Chrome.

@sai-san
Copy link
Collaborator

sai-san commented Mar 1, 2021

Can do, but note that we would keep showing all the Popovers by default, to allow for visual regression tests to verify their position and appearance.

Yes, showing the popovers by default is perfect, thanks for covering for that! At the moment, all the popovers disappear when any of the buttons in the All page is clicked, so I thought that using the button labels to indicate direction could be nice for orientation.

I agree, but that becomes tricky together with the above requirement of showing all the Popovers right from the start. Though we could probably reduce the distance between two components a bit, that should already help. And maybe change the order of the Popover-positions a bit, that should also help.

The All page looks so much better now! Thanks 🙏

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 1, 2021

@SaiSan-WMDE I adjusted storybook a bit. What do you think?

Safari is broken because of a problem with our PostCSS setup. I'll made a dedicated ticket for that: T276028.
It probably should go into its own pull request as it isn't really related to this PR, it is just the most obvious here.
But I think the checkbox might be broken in Safari as well? (not sure)

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 1, 2021

At the moment, all the popovers disappear when any of the buttons in the All page is clicked, so I thought that using the button labels to indicate direction could be nice for orientation.

Gotcha, will fix!

@micgro42 micgro42 force-pushed the PopoverComponent branch 4 times, most recently from 3b8efb3 to 761e22b Compare March 1, 2021 11:32
@sai-san
Copy link
Collaborator

sai-san commented Mar 1, 2021

It probably should go into its own pull request as it isn't really related to this PR, it is just the most obvious here.
But I think the checkbox might be broken in Safari as well? (not sure)

You're probably right 😕 I'll do an overall review in Safari to collect all the issues. I could document them in a Phab ticket in case that's useful.

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 1, 2021

It probably should go into its own pull request as it isn't really related to this PR, it is just the most obvious here.
But I think the checkbox might be broken in Safari as well? (not sure)

You're probably right confused I'll do an overall review in Safari to collect all the issues. I could document them in a Phab ticket in case that's useful.

Yes, if you find issues other than this and in the Checkbox, then another Phabricator ticket would be a good idea

@micgro42 micgro42 force-pushed the PopoverComponent branch 2 times, most recently from ed56a2f to 29600bc Compare March 1, 2021 14:57
@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 1, 2021

Mh, changing those button labels revealed some more positioning problems. Will look into them today.

The scss use directive has to be added to vue.config.js because it has
to be in front of all other rules.

Co-authored-by: bereket-WMDE <71328938+bereket-WMDE@users.noreply.github.com>
Easiest would be to manually define two explicit rtl and ltr blocks to
workaround transforms not being handled by postcss-logical, but that
doesn't work because we're prefixing _everything_ with .wikit :/

So we need to figure out how to not rely on translateX and horizontally
moved origins of transformation.
@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 1, 2021

This should now fix most of the rtl positioning issue, except one, the horizontally centered position. That one needs more thinking.

translateX isn't adjusted by postcss-logical, therefore we have to make
use of flexbox also somewhat affecting its absolute positioned children.
@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 2, 2021

@SaiSan-WMDE This should now be finally ready to properly review :)

@sai-san
Copy link
Collaborator

sai-san commented Mar 2, 2021

The All page looks quite confusing now:

  • Why is the style of the buttons not matching normal neutral?
  • Probably those h2 should have a 100% width, so the buttons go back to be aligned in columns of 4.
  • Seeing RTL makes me think that probably we should rename all "right" and "left" props to "end" and "start" respectively. Otherwise, it's really confusing. What do you think?

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 2, 2021

The All page looks quite confusing now:

* Why is the style of the buttons not matching normal neutral?

Yikes, the color was only for testing purposes to see where the middle of the button is exactly! Will fix that!
The higher height was necessary, to ensure that the buttons are actually aligned to the middle, because previously they were sometimes aligned to the top or the button and it worked just because the small height of the button matched with the small height of the Popover.

* Probably those h2 should have a 100% width, so the buttons go back to be aligned in columns of 4.

Not sure what you mean, but can do.

* Seeing RTL makes me think that probably we should rename all "right" and "left" props to "end" and "start" respectively. Otherwise, it's really confusing. What do you think?

so top-start, top, top-end, end-top, end-center, end-bottom, bottom-end, bottom-center, bottom-start, start-bottom, start, start-top? 🤔

remove debugging color and make headline be on its own line.
This accounts for the Popover actually switching sides between ltr and
rtl.
@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 2, 2021

So, now it should be better. Let me know what you think, @SaiSan-WMDE 😊

@sai-san
Copy link
Collaborator

sai-san commented Mar 2, 2021

Thanks for all the changes! 🙏

so top-start, top, top-end, end-top, end-center, end-bottom, bottom-end, bottom-center, bottom-start, start-bottom, start, start-top? 🤔

Position will never stop being somewhat confusing, but maybe now the indicator is more aligned with the implementation, and it communicates the actual RTL position properly, unlike before:

Screenshot 2021-03-02 at 11 59 26

@sai-san
Copy link
Collaborator

sai-san commented Mar 2, 2021

Safari issues will still need to be tackled (in a separate PR, as discussed), and the responsive behavior of popovers should be discussed, but I'd say at this point this is ready to be merged?

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 2, 2021

Safari issues will still need to be tackled (in a separate PR, as discussed), and the responsive behavior of popovers should be discussed, but I'd say at this point this is ready to be merged?

Wait, the Safari-Issues should be fixed. Do they still exist?

@sai-san
Copy link
Collaborator

sai-san commented Mar 2, 2021

Wait, the Safari-Issues should be fixed. Do they still exist?

I'm afraid they do, but only in the Basic page:

Screenshot 2021-03-02 at 14 37 13

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 2, 2021

Wait, the Safari-Issues should be fixed. Do they still exist?

I'm afraid they do, but only in the Basic page:

Screenshot 2021-03-02 at 14 37 13

Oh right. I have that fixed in a minute.

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 2, 2021

Wait, the Safari-Issues should be fixed. Do they still exist?

I'm afraid they do, but only in the Basic page:
Screenshot 2021-03-02 at 14 37 13

Oh right. I have that fixed in a minute.

Should be fixed now :)

@sai-san sai-san merged commit 43bd206 into create-popover-tokens Mar 2, 2021
@sai-san sai-san deleted the PopoverComponent branch March 2, 2021 16:53
sai-san added a commit that referenced this pull request Mar 2, 2021
* First draft of the popover tokens

* Update Popover.json

* Update Popover.json

* Update Popover.json

* Update tokens/properties/components/Popover.json

* Update tokens/properties/components/Popover.json

* Update tokens/properties/components/Popover.json

* Update tokens/properties/components/Popover.json

* Update tokens/properties/components/Popover.json

* Update tokens/properties/components/Popover.json

* feat: add Popover component (#373)

* feat: add Popover component

The scss use directive has to be added to vue.config.js because it has
to be in front of all other rules.

Co-authored-by: bereket-WMDE <71328938+bereket-WMDE@users.noreply.github.com>

* Fix most rtl positioning issues

Easiest would be to manually define two explicit rtl and ltr blocks to
workaround transforms not being handled by postcss-logical, but that
doesn't work because we're prefixing _everything_ with .wikit :/

So we need to figure out how to not rely on translateX and horizontally
moved origins of transformation.

* Fix alignment of horizontal center tooltips

translateX isn't adjusted by postcss-logical, therefore we have to make
use of flexbox also somewhat affecting its absolute positioned children.

* Fix story layout

remove debugging color and make headline be on its own line.

* Change left to start and right to end for Popover

This accounts for the Popover actually switching sides between ltr and
rtl.

* Set direction in story explicitly to fix Safari

Co-authored-by: bereket-WMDE <71328938+bereket-WMDE@users.noreply.github.com>

Co-authored-by: Michael Große <michael.grosse@wikimedia.de>
Co-authored-by: bereket-WMDE <71328938+bereket-WMDE@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants