Skip to content

Commit

Permalink
fix(alert): remove border-right on ios stacked buttons (#28821)
Browse files Browse the repository at this point in the history
Issue number: internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When iOS alert has 3 or more buttons, those are rendered vertically. All
but the last button will have a right border. There shouldn't be a right
border when the buttons are stacked.

![Group
2(1)](https://github.com/ionic-team/ionic-framework/assets/13530427/0bc2a46e-554c-459a-85cb-990f4b4918ed)


## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Vertical buttons don't have a right border.
- Separated the test in order to also test dark theme.

![Screenshot 2024-01-12 at 1 00
54 PM](https://github.com/ionic-team/ionic-framework/assets/13530427/5ec9d00f-2893-4045-9b63-2817549c80b1)
![Screenshot 2024-01-12 at 12 58
22 PM](https://github.com/ionic-team/ionic-framework/assets/13530427/5b64a959-b8e1-4b6a-bd9c-92d1d381a65a)


## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

N/A

---------

Co-authored-by: ionitron <hi@ionicframework.com>
  • Loading branch information
thetaPC and Ionitron committed Jan 17, 2024
1 parent aed7a03 commit ad65824
Show file tree
Hide file tree
Showing 26 changed files with 51 additions and 5 deletions.
16 changes: 16 additions & 0 deletions core/src/components/alert/alert.ios.scss
Expand Up @@ -265,6 +265,22 @@
flex-wrap: $alert-ios-button-group-flex-wrap;
}

/**
* The right border should only be applied to the first button
* when the group has 2 or less buttons (horizontal).
* Otherwise, the right border should not be applied
* when the group has 3 or more buttons (vertical).
*/
.alert-button-group-vertical .alert-button {
border-right: none;

&:last-child {
@include rtl() {
border-right: none;
}
}
}

.alert-button {
/**
* This padding ensures that alerts
Expand Down
40 changes: 35 additions & 5 deletions core/src/components/alert/test/basic/alert.e2e.ts
Expand Up @@ -73,11 +73,6 @@ configs().forEach(({ config, screenshot, title }) => {
await alertFixture.screenshot('longMessage');
});

test('more than two buttons', async () => {
await alertFixture.open('#multipleButtons');
await alertFixture.screenshot('multipleButtons');
});

test('no message', async () => {
await alertFixture.open('#noMessage');
await alertFixture.screenshot('noMessage');
Expand Down Expand Up @@ -105,6 +100,41 @@ configs().forEach(({ config, screenshot, title }) => {
});
});

configs({ themes: ['light', 'dark'] }).forEach(({ config, screenshot, title }) => {
test.describe(title('should not have visual regressions'), () => {
test('more than two buttons', async ({ page }) => {
await page.setContent(
`
<ion-alert
header="Alert"
sub-header="Subtitle"
message="This is an alert message."
is-open="true"
></ion-alert>
<script>
const alert = document.querySelector('ion-alert');
alert.buttons = [
'Open Modal',
{
text: 'Delete',
id: 'delete-button',
role: 'destructive',
},
'Cancel'
];
</script>
`,
config
);

const alert = page.locator('ion-alert');

await expect(alert).toHaveScreenshot(screenshot(`alert-multipleButtons`));
});
});
});

class AlertFixture {
readonly page: E2EPage;
readonly screenshotFn?: (file: string) => string;
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ad65824

Please sign in to comment.