Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

i/5806: Rounded corners should work for dropdown panel children in all positions #254

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

oleq
Copy link
Member

@oleq oleq commented Nov 26, 2019

Suggested merge commit message (convention)

Fix: Rounded corners should work for dropdown panel children in all panel positions. Closes ckeditor/ckeditor5#5806.


image

image

@oleq oleq requested a review from dkonopka November 26, 2019 09:03
@dkonopka
Copy link
Contributor

dkonopka commented Dec 9, 2019

I've found some minor issue, but this is related to the dropdown panel I guess and we can make it as followup?

Screenshot 2019-12-09 at 15 28 07

@Reinmar Reinmar requested review from panr and removed request for dkonopka March 27, 2020 17:59
@Reinmar
Copy link
Member

Reinmar commented Mar 27, 2020

@oleq @panr could you close this? :D One way or the other.

@oleq
Copy link
Member Author

oleq commented Apr 9, 2020

I've found some minor issue, but this is related to the dropdown panel I guess and we can make it as followup?

This cannot be fixed. The roundness of the panel is OK because the panel assumes the content will be horizontal and wider than the dropdown button.

It's the toolbar that is vertical (it has a class) and the dropdown has no way to learn about it. We'd need to re-write some logic in JS to give the panel some class if the toolbar child is vertical but I thing this is way too much hassle.

@oleq
Copy link
Member Author

oleq commented Apr 9, 2020

Anyway, let's give this PR another try. @panr?

Copy link
Contributor

@panr panr left a comment

Choose a reason for hiding this comment

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

👇🏻More like discussion than requesting changes right now.

@mixin ck-rounded-corners {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like it... Using this mixin here, repeatedly, makes the code too long and hard to read IMHO.
I think we should create a similar mixin but for reseting radiuses. Then we can mix it with ck-rounded-corners but also use it here to reset those and apply radius only for the one corner. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what the mixin looks like https://github.com/ckeditor/ckeditor5-theme-lark/blob/0115e9440ce152135164ba4e4b6ad831b56ab6fd/theme/mixins/_rounded.css#L11-L20

All it does it border-radius: var(--ck-border-radius); and then everything from the brackets. It works as an exclusion.

A mixin for resetting radiuses would... look exactly the same as @mixin ck-rounded-corners I guess. So I'm not sure we would gain that much code. postcss-mixins does not support conditionals so there's no way to specify which radiuses should be reset.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I know how the mixin looks like, checked it before ;-) So basically:

@mixin ck-rounded-corners {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	border-bottom-left-radius: 0;
}

does the same thing as:

border-radius: 0;
border-top-left-radius: var(--ck-border-radius);

right?

The latter is much simpler to me, so my suggestion is to apply the code above or introduce:

@mixin ck-reset-corners {
    border-top-left-radius: var(--ck-border-radius);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes sense but honestly, I'm confused by the naming. ck-rounded-corners enables rounded corners then you can opt-out from some of them. ck-reset-corners also adds rounded corners but it does not make sense standalone without @mixin-content.

Maybe we should investigate and see if there's a chance for us to write mixins in JS. We could have a better rounded-corners mixin then:

/* Enable all */
@mixin ck-rounded-corners;

/* Enable bottom-right and top-left only */
@mixin ck-rounded-corners bottom-right top-left;

/* Do something custom (it only adds selectors) */
@mixin ck-rounded-corners {
    border-top-left-radius: 2cm;
}

I'm not sure how this could work with our ultra-modular framework. That's probably a follow-up.

Copy link
Contributor

Choose a reason for hiding this comment

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

I get your point here. So to wrap it all up, you still prefer this:

@mixin ck-rounded-corners {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	border-bottom-left-radius: 0;
}

over this:

border-radius: 0;
border-top-left-radius: var(--ck-border-radius);

?

@panr
Copy link
Contributor

panr commented Apr 16, 2020

Also #254 (comment) I think there is a chance to handle this. We can set overflow: hidden to the element and then set the right radius to it. Yes I know that this will trim the visibility of the tooltip, but there is a trick to set this right.

- parent/container (position: relative)
  - element (position: static; overflow: hidden)
    - tooltip (position: absolute)

@oleq
Copy link
Member Author

oleq commented Apr 16, 2020

Also #254 (comment) I think there is a chance to handle this. We can set overflow: hidden to the element and then set the right radius to it. Yes I know that this will trim the visibility of the tooltip, but there is a trick to set this right.

If you set the overflow, this will not resolve the issue b/c the panel has the rounded upper-right corner anyway, which is right and wrong at the same time.

Right, because this is a south-west panel, like the heading panel. It is not aware (on the JS level) of the fact it is so narrow its upper-right corner is aligned with the button that opens it.

Wrong, because it looks odd. And there's no way to change it ATM without refactoring in JS that would probably add another class.


Long story short this is what it corresponds to

image

and even if it was fixed

image

this will still look weird after all

image

@panr
Copy link
Contributor

panr commented Apr 16, 2020

#254 (comment) Gotcha!

But I'm still thinking about this trick... Maybe it will help us reduce some redundant radius resets🤔

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rounded corners should work for dropdown panel children in all panel positions
4 participants