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(button): set default shape to soft for ios and round for md and ionic themes #29404
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the buttons without a shape set in this test to use the soft
shape because it doesn't make sense using the default round
shape that ionic & md themes use since the round
shape is excluded from some of the styles:
:host(.button-full:not(.button-round)) .button-native {
@include border-radius(0);
border-right-width: 0;
border-left-width: 0;
}
/** | ||
* Shape="rectangular" is only available in the Ionic theme. | ||
*/ | ||
// TODO do we need this test for focused / activated? it should be for all themes if so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to determine if we need this test or if there is a way to slim it down / move it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up removing this test because the activated state does not get changed based on the shape & we are checking that the focused state is the proper shape in the clear button tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question unrelated to this PR: Is test supposed to be capturing the ripple effect? It seems like a normal state button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it looks like it should be:
test.describe(title('button: ripple effect'), () => {
test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/button/test/basic?ionic:_testing=false`, config);
const button = page.locator('#default');
await button.scrollIntoViewIfNeeded();
const boundingBox = await button.boundingBox();
if (boundingBox) {
await page.mouse.move(boundingBox.x + boundingBox.width / 2, boundingBox.y + boundingBox.height / 2);
await page.mouse.down();
}
await page.locator('#default.ion-activated').waitFor();
await expect(button).toHaveScreenshot(screenshot(`button-ripple-effect`));
});
});
I am not sure when it stopped working though
...tates/button.e2e.ts-snapshots/button-activated-outline-color-ios-ltr-Mobile-Chrome-linux.png
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue number: internal
What is the current behavior?
The
shape
property defaults to"soft"
forios
and"round"
for themd
andionic
themes.Default button size:
ionic
)ios
)md
)undefined
8px
14px
4px
"round"
999px
"rectangular"
0px
Large button size:
ionic
)ios
)md
)undefined
8px
16px
4px
Small button size:
ionic
)ios
)md
)undefined
4px
6px
4px
What is the new behavior?
The
shape
property defaults toundefined
which evaluates to the "Soft" shape for all themes.Default button size:
ionic
)ios
)md
)"soft"
8px
6px
4px
"round"
999px
999px
999px
"rectangular"
0px
0px
0px
Large button size:
ionic
)ios
)md
)soft
8px
8px
4px
Small button size:
ionic
)ios
)md
)soft
4px
4px
4px
"soft"
shape in theionic
theme using the existing values forundefined
"rectangular"
and"round"
shapes inios
andmd
using0px
and999px
border radius"round"
for theionic
andmd
themes and"soft"
forios
and updates theborder-radius
to apply to the shape classes instead of:host
"soft"
shape border radius forios
in the various sizes to match the buttons created in SwiftUI (their "rounded" is our "soft"):"ionic"
theme so that they are not styled based on the size while always following the proper aspect ratio. This was broken for the default size due to an incorrect padding value & I made it so we don't have to specify the padding for each size:Does this introduce a breaking change?
BREAKING CHANGE:
The
border-radius
of theios
andmd
button now defaults to6px
and999px
instead of14px
and4px
, respectively, in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set theshape
to"soft"
formd
and override the--border-radius
CSS variable forios
to14px
, or set it to a different value entirely.