-
Notifications
You must be signed in to change notification settings - Fork 718
[css-borders-4] corner-shape initial value ("round") is strange in some cases (e.g. bevel) #11623
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
Comments
|
When I create an element on the web it's default corner shape is square. The heart of the problem here is the shoehorning of An example to illustrate is this page for the upcoming pokemon game (https://www.pokemon.co.jp/ex/legends_z-a/ja/story/). The beveled corners on the I can't think of another situation like this in CSS when a non-default style is forced on developers when a certain property is used. It would be something like if a developer declared an unsupported p3 background color the browser just gives you A way around this problem is to create a |
What would be the default shape with a non-zero corner-size, and how would it interact with a border-radius? I agree that when the design is mostly straight, falling back to something rounded is not ideal visually. I think something like this is more readable than introducing an additional corner-sizing property: @supports (corner-shape: bevel) {
border-radius: 10px;
corner-shape: bevel;
} |
my immediate thought is a my thought is if
i don't think that asking for the radius of a bevel, notch, or square is very readable |
Those are very specific values though, and animating between them + all the other values createa curved in-betweena with a radius. That was the logic for going with general superellipse as the underlying value rather than special-casing bevel/notch. If you think of bevel/notch as a superellipse with a 0/-infinity value, it doesn't only make them more consistent with the term "radius" but also makes those relative to the other values and thus animatable. |
I'm aware that the implementation of this uses a superellipse and it's what got all of this off the ground and I appreciate that but I don't think that in practice any front-end dev/designer (really anyone other than the engineers that implement this) will think about it this way. |
@jsnkuhn do you mind formulating the |
As much as I'd like to be able to say "yes" to this I can not dedicate that amount of time to this without pay. Is there potentially a developer advocate at Chrome that can be brought in here to help? |
Fair enough! @SebastianZ @LeaVerou @fantasai @smfr @bramus @tabatkins @yisibl does anyone else resonate with the points here, of perhaps having a separate sizing attribute because some corner shapes are not a "radius"? The fact that the combination of "bevel" and "radius" seems odd resonates with me, but I believe what we've achieved is still the best tradeoff. |
@jsnkuhn btw |
I can try and clarify what I'm asking a bit: Important point is that there would be no cross over between
|
I've always thought that rounding is an odd and not very useful fallback for most corner shapes. In many cases, rectangular corners would be a much better fallback. But most importantly, keeping them separate allows for them to be combined, e.g. using |
I see the #9843 as more related to stroke, like "stroking the border with round joins" rather than something that's connected with I think that with squircles and similar round-ish shapes (which is one of the major use cases for this) falling back to rounded corners makes a lot more sense than falling back to having zero radius. I think we can do the following:
I am not sure if this is very necessary but definitely possible if it makes things more readable for designers. |
another example here to show that the border-radius fallback won't even always be what devs want when falling back from The squircle design I'm trying to make is the blue element in the middle. Its a squircle of 70px. The red element on left is the forced border-radius: 70px; fallback. It looks nothing like what I want. The corners are crowding the links way too much. The yellow element on the right is a close enough approximation of what I want with default round border-radius but the value has to be 35px (half of the squircle value) to get there. So even in this case I'd have to @supports my way around the default fallback. |
OK, to clarify how I think this would work if we accept this direction:
This allows using Note that this is backwards compatible with what's being built right now, however it means that until something like |
Another option, perhaps, better, is to have a
Where the author has to specify both a shape and a size (neither are optional), but can declare 1..4 corners. e.g.: corners: bevel 10px / round 20% 30px / none / squircle 3px; This way, authors can be sure that the radius they provide is attached to a particular shape and doesn't individually fall back to border-radius. Note that this does not introduce new longhands - it would resolve to |
I don't think I agree with the core argument of this thread. If a value isn't supported, there is no fallback that is guaranteed to be correct. Defaulting to "round" is just as likely to be reasonable as defaulting to "square", without context, and I think in practice it's much more likely to be correct. Looking at the examples given in this thread:
There wasn't an example of this given in the thread yet, but squircle corners would definitely be best falling back to "round". The concave values are a harder sell, just because there's no close example, but if I had to choose between "round" and "square" to render a "scoop" with, I think I'd still choose a "round" as the most reasonable default, simply because it cuts out something from the corners and breaks up the strict rectilinear lines, which is usually the core of the effect you're reaching for. If your particular use-case disagrees with this, and you think square would be a better fallback in older browsers, we already have a solution for that - That said, I definitely wouldn't object to a 'corners' shorthand setting both 'border-radius' and 'corner-shape', which would happen to function as a "soft" fallback to square corners in legacy UAs (since they'd ignore the shorthand and not end up setting 'border-radius' either). |
There is an example of squircles above: #11623 (comment) As stated there while I guess the other thing to keep in mind is that hopefully any issues with fallback for unsupported browsers won't be around that long. The only issue that would remain long term is questions like "why is CSS asking for the radius of a notch or an angle". Very much agree that there should be a |
Proposing #11623 (comment) as a resolution for this issue. |
I'd be fine with adopting either or both of #11623 (comment) ( |
+1 to |
+1 to |
I think there is general consensus here. A
e.g. corners: bevel 10px / round 20% 30px / none / squircle 3px; |
What corner shape is implied by "none"? Obviously it's a radius of 0px. Is it "round"? |
Yes, '0px round' |
#10993 (comment)
Wouldn't the initial value for
corner-shape
have to be square/rect? to match most existing elements on the web? And that would mean "square/rect" would also need to be an option. So that we could do something likecorner-shape: square angle square square;
(#6980 (comment))
The text was updated successfully, but these errors were encountered: