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

ToggleButton and ToggleButtonGroup #358

Merged
merged 10 commits into from
Jan 26, 2021

Conversation

micgro42
Copy link
Collaborator

Works, but not sure if those props make any sense at all

@github-actions
Copy link

@sai-san sai-san requested a review from a team January 20, 2021 10:24
@micgro42 micgro42 mentioned this pull request Jan 20, 2021
@Ladsgroup
Copy link
Contributor

So far looks actually pretty okay and we can get it in IMHO, I don't see the point on calling this POC but the only thing is the you can't unselect a button (returning a group to its default state depending default state is selected a button or nothing is selected)

The story book also needs work (disabled state, etc.)

@Ladsgroup Ladsgroup marked this pull request as ready for review January 22, 2021 11:54
@Ladsgroup
Copy link
Contributor

Everything I did is in this commit: 744d6c1

@micgro42 micgro42 changed the title ToggleButton PoC ToggleButton and ToggleButtonGroup Jan 22, 2021
background-color: $wikit-ToggleButton-disabled-background-color;
}

@media (max-width: $width-breakpoint-mobile) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looking at storybook, I have the strong suspicion that this media-query is not working

Copy link
Contributor

Choose a reason for hiding this comment

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

I double checked it before making the patch and it worked fine. Maybe you're checking against tablet breakpoint? The mobile breakpoint is pretty small.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My bad, the media-query is indeed working fine!
It is that box-sizing: border-box; is missing. That is why the buttons are so strangely large ^^

The m-sized buttons are supposed to have a total height of 32px, not 44px :)

Also, @SaiSan-WMDE , I think we might be missing some component tokens for the min-height.

Copy link
Contributor

Choose a reason for hiding this comment

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

Added box-sizing: border-box;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi! Thanks for working on this, and for adding box-sizing: border-box;. The size of buttons looks good now. We do have min-height tokens, but we haven't been using them with the button component because they proved to be unnecessary. Should that change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Quick question: In they proved to be unnecessary, by they you mean the min-height css style or the min-height tokens?
The min-height css styles are in the figma specs and I set them as it's there. If we need to not use them, that's fine.

If that's about the tokens themselves, I'm fine with moving like this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Using the CSS style, and therefore the tokens to define it, seemed to not have a real impact on the component, as far as I remember. I'd say we can move on like this.

I should be rephrasing many of the Figma specs, to avoid them from being interpreted as implementation decisions. Now that UX creates component tokens, these should be considered the design source of truth by developers.

(Leaving more feedback in a separate comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Done. Removed the min-height css.

@Ladsgroup Ladsgroup force-pushed the ToggleButtonPoC branch 4 times, most recently from 4dfb8f4 to ea7fc35 Compare January 25, 2021 10:19
@sai-san
Copy link
Collaborator

sai-san commented Jan 25, 2021

This is looking fantastic. The main thing to solve from a UI point of view is still the border radius of the buttons that occupy a central position: for some reason is still not 0px.

@Ladsgroup
Copy link
Contributor

This is looking fantastic. The main thing to solve from a UI point of view is still the border radius of the buttons that occupy a central position: for some reason is still not 0px.

I couldn't find any issues with on main toggle group but I saw the problem in the disabled one, It should be fixed now.

@sai-san
Copy link
Collaborator

sai-san commented Jan 25, 2021

I couldn't find any issues with on main toggle group but I saw the problem in the disabled one, It should be fixed now.

It appears that the buttons are not displaying the right border radius in none of the states (checking on Chrome/MacOS):

Screenshot 2021-01-25 at 12 27 32

Buttons should look more integrated in the group. Adjacent borders should not display any roundness:

Screenshot 2021-01-25 at 12 34 11

@Ladsgroup
Copy link
Contributor

Mine looks different
image

Maybe it's an outdated version?

@Ladsgroup
Copy link
Contributor

aha, it looks fine in firefox but not in chrome :(

@Ladsgroup
Copy link
Contributor

aha, it looks fine in firefox but not in chrome :(

In Chrome it says "unknown property type" for border-start-start-radius: 0; and the rest.

@Ladsgroup
Copy link
Contributor

It's not working on Chrome below 89 https://caniuse.com/?search=border-start-start-radius, we can have it now and slowly wait until it rolls out?

@sai-san
Copy link
Collaborator

sai-san commented Jan 25, 2021

aha, it looks fine in firefox but not in chrome :(

oh nooo. That's usually the other way around.

It's not working on Chrome below 89 https://caniuse.com/?search=border-start-start-radius, we can have it now and slowly wait until it rolls out?

I actually checked the component on Chrome 89 using BrowserStack and the borders still look broken :-/

@sai-san
Copy link
Collaborator

sai-san commented Jan 25, 2021

Should we use border-bottom-right-radius etc?

@Ladsgroup
Copy link
Contributor

That would break in RTL languages :( We can go with it for now?

@itamargiv
Copy link
Member

It's not working on Chrome below 89 https://caniuse.com/?search=border-start-start-radius, we can have it now and slowly wait until it rolls out?

The installed postcss plugin postcss-logical is supposed to take care of transpilation of logical properties into physical ones, and it is supposed to support border-start-end-radius and border-start-start-radius etc. We should check first if the problem is in our side or the implementation, and then check if there's a bug with the plugin.

@Ladsgroup
Copy link
Contributor

Ladsgroup commented Jan 25, 2021

This is very likely this: csstools/postcss-logical#27

@Ladsgroup
Copy link
Contributor

This is very likely this: csstools/postcss-logical#27

Until that issue is resolved. I made a change that basically is the post-build of postcss and it should work just fine now.

Copy link
Member

@itamargiv itamargiv left a comment

Choose a reason for hiding this comment

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

Looking great, thanks for picking this up! I've added a request for change as a result of a small discussion above, I will review again after the design is approved.

vue-components/src/components/ToggleButtonGroup.vue Outdated Show resolved Hide resolved
@itamargiv
Copy link
Member

This is very likely this: csstools/postcss-logical#27

Until that issue is resolved. I made a change that basically is the post-build of postcss and it should work just fine now.

LOL, didn't see this comment, as I was on the review screen, sorry for repeating what you said.

@sai-san
Copy link
Collaborator

sai-san commented Jan 25, 2021

Agh, not sure what changed, but the borders were fixed before the last commit, and now they look off again 😮

Last thing from a design pov. The focus state needs fixing:

  • Would it be possible to apply the same logic and remove the border radius of the converging borders on focus? Ideally, they should look/behave like this:

Screenshot 2021-01-25 at 18 05 40

  • It also looks like different focus styles are being applied to the buttons on the group? And that the tokens are being overridden somehow?

Screenshot 2021-01-25 at 17 49 44

@Ladsgroup
Copy link
Contributor

It's broken again because chrome doesn't :dir() either: https://caniuse.com/?search=dir()
Unbelievable

@Ladsgroup
Copy link
Contributor

Also looking at output of postcss-logical, it outputs something like [dir="ltr"] .theselector which doesn't work if you don't set dir attribute or set it to "auto" (to get it from the language) which is the case for the storybook. I have a feeling that the storybook will look hideous in Persian.

@itamargiv
Copy link
Member

Also looking at output of postcss-logical, it outputs something like [dir="ltr"] .theselector which doesn't work if you don't set dir attribute or set it to "auto" (to get it from the language) which is the case for the storybook. I have a feeling that the storybook will look hideous in Persian.

I think a quick way around it is to wrap the story with a div that sets the dir attribute.

@itamargiv
Copy link
Member

itamargiv commented Jan 26, 2021

It also looks like different focus styles are being applied to the buttons on the group? And that the tokens are being overridden somehow?

BTW, This can be fixed by setting outline: none on the :focus state of the child of the group and replacing it with an inset box-shadow.

@sai-san
Copy link
Collaborator

sai-san commented Jan 26, 2021

Ok, current status.

Firefox:

Screenshot 2021-01-26 at 15 42 33

  • Border radius are fine 💯
  • Focus state is consistent, but there're a couple of issues:
  1. One of the borders is always thinner than the other, but I understand this might not be easy to solve and therefore would make a compromise there.
  2. There's an unwanted dotted border surrounding the buttons on focus

Chrome:

Screenshot 2021-01-26 at 15 43 43

Same issues persist:

  1. Inconsistent focus styles between buttons (and – same as Firefox – uneven widths)
  2. Broken border radius (the border radius of central buttons should be 0px)

@Ladsgroup
Copy link
Contributor

Are you sure you have the current version? This is the chrome for me now
image

@Ladsgroup
Copy link
Contributor

Can't reproduce the dotted border in firefox either :(

Ladsgroup and others added 2 commits January 26, 2021 18:25
Co-authored-by: Sai_San <sarai.sanchez@wikimedia.de>
Co-authored-by: Sai_San <sarai.sanchez@wikimedia.de>
@Ladsgroup
Copy link
Contributor

Sure. Applied.

@sai-san
Copy link
Collaborator

sai-san commented Jan 26, 2021

I was looking at the seemingly fresh Chromatic link. The one that technically was generated after adding outline:none and the dir property to the div (I checked the Files changed) 🤔
But anyway: the dotted line is finally gone after adding those extra outline:none's.

Full disclosure, the focus styles will be updated in a separate task that impacts tokens at a higher level (T272626), but that's a different story to be tackled by the constellation.

Here everything looks good! 💯 Thanks sooo much, Amir 🙏

@sai-san sai-san merged commit 5639a2b into create-toggle-button-tokens Jan 26, 2021
@sai-san sai-san deleted the ToggleButtonPoC branch January 26, 2021 17:55
Ladsgroup added a commit that referenced this pull request Jan 27, 2021
* create skeleton

* Update ToggleButton.json

* Update tokens/properties/components/ToggleButton.json

* Update ToggleButton.json

* ToggleButton and ToggleButtonGroup (#358)

* ToggleButton PoC

* Second attempt: fix it in render

* Silencing typescript errors

* Use provide/inject

* Fixed injection types

* Add documentation to props and slots

* Make ToggleButton ready for review

* Fixes

* Update vue-components/src/components/ToggleButton.vue

Co-authored-by: Sai_San <sarai.sanchez@wikimedia.de>

* Update vue-components/src/components/ToggleButton.vue

Co-authored-by: Sai_San <sarai.sanchez@wikimedia.de>

Co-authored-by: Amir Sarabadani <Ladsgroup@gmail.com>
Co-authored-by: Sai_San <sarai.sanchez@wikimedia.de>

* Final fixes

Co-authored-by: Michael Große <michael.grosse@wikimedia.de>
Co-authored-by: Amir Sarabadani <Ladsgroup@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants