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

fix(action-sheet): background includes safe area margin #24700

Merged
merged 2 commits into from
Feb 7, 2022
Merged

Conversation

sean-perkins
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The safe area is being applied to the action sheet container, which does not have the background appearance applied to it. This pushes the container up, but leaves an empty space between the last group in the action sheet and the bottom bevel of the screen.

Issue Number: #24699

What is the new behavior?

Safe are padding is applied to the last group of the action sheet, which has the background appearance applied to it. This will extend the container's visual appearance to the bottom bevel on an Android device.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@sean-perkins sean-perkins requested a review from a team as a code owner February 2, 2022 18:21
@github-actions github-actions bot added the package: core @ionic/core package label Feb 2, 2022
@@ -67,7 +67,7 @@

.action-sheet-wrapper {
@include position(null, 0, 0, 0);
@include margin(var(--ion-safe-area-top, 0), auto, var(--ion-safe-area-bottom, 0), auto);
@include margin(var(--ion-safe-area-top, 0), auto, 0, auto);
Copy link
Contributor

@liamdebeasi liamdebeasi Feb 2, 2022

Choose a reason for hiding this comment

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

This will break the safe area for iOS. The action sheet on iOS should move above the safe area, while the MD action sheet's content should move above the safe area, but the container should extend below the safe area.

I think what was wrong in my previous patch was that iOS safe area should use margin, but MD safe area should use padding.

It might make sense to revert https://github.com/ionic-team/ionic-framework/pull/24176/files and then add

.action-sheet-wrapper {
  @include padding(var(--ion-safe-area-top, 0), auto, var(--ion-safe-area-bottom, 0), auto);
}

Or something to account for the safe area in MD mode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch 👍 Although the padding/margin cannot be applied to the action-sheet-wrapper in MD, as it will increase the container size (good), but won't increase the container space the background color is applied to (bad).

Likely we will have to do specific styles in iOS vs. MD stylesheets. As iOS pushes the space from the bottom, but doesn't have a background applied.

@sean-perkins
Copy link
Contributor Author

Still need to verify on device, will re-request reviews after I get a chance to do that. Few meetings first ⏳

@sean-perkins sean-perkins requested review from a team and liamdebeasi February 2, 2022 20:32
@sean-perkins
Copy link
Contributor Author

Ok, confirmed this maintains iOS visual behavior and fixes the MD display. We may want to consider visual regression tests in the future that simulate safe areas 🤔

@liamdebeasi
Copy link
Contributor

We should already have a safe area test: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/action-sheet/test/basic/index.html#L50-L55

The visual regression URL isn't super visible anymore, but here's the diff for your latest commit: https://screenshot.ionicframework.com/7315e01/bf6bf00

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Feb 2, 2022

Oh scratch that, we don't have an E2E test that actually opens the action sheet with added safe area. Could you add one?

@sean-perkins
Copy link
Contributor Author

Oh scratch that, we don't have an E2E test that actually opens the action sheet with added safe area. Could you add one?

@liamdebeasi looks like the /app/test/safe-area/ covers this behavior 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants