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

bug: Swipe to dismiss not working properly on toast with customized ::part(container) css #29998

Closed
3 tasks done
aeharding opened this issue Nov 5, 2024 · 0 comments · Fixed by #29999
Closed
3 tasks done
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@aeharding
Copy link
Contributor

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

I have some CSS to center the toast message with its icon. Here is the css:

ion-toast::part(container) {
  display: inline-flex;
  transform: translateX(-50%);
  left: 50%;
  position: relative;
}

With this CSS, I can no longer swipe to dismiss unless I start the swipe from over the .toast-container element:

image

This is because the ion-toast has pointer-events: none and it is reset on the .toast-container element with pointer-events: auto.

Expected Behavior

Can swipe from anywhere on the toast, even with custom layout applied to ::part(container)

Steps to Reproduce

  1. Visit https://stackblitz.com/edit/kvqhk5
  2. Open toast
  3. Try to swipe from the far left and right sides of the toast. Observe it doesn't work.
  4. Try to swipe from the center of the toast. Observe it works.

Code Reproduction URL

https://stackblitz.com/edit/kvqhk5

Ionic Info

Latest Ionic Stackblitz

Additional Information

This could be fixed by moving pointer-events: auto from .toast-container to .toast-wrapper. I will make a pr :)

@ionitron-bot ionitron-bot bot added the triage label Nov 5, 2024
@sean-perkins sean-perkins added package: core @ionic/core package type: bug a confirmed bug report labels Nov 13, 2024
@ionitron-bot ionitron-bot bot removed the triage label Nov 13, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 14, 2024
Issue number: resolves #29998

---------

<!-- 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?

Applying a custom layout to `ion-toast::part(container)`, for example
`width: 50%`, will make the part of the toast outside this element's
bounds non-interactive for swiping gestures.


## What is the new behavior?

Can swipe from anywhere on the toast with custom layout applied to
::part(container)

## 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/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

| Before | After                                         |
|-------|-----------------------------------------------------|
| <video
src="https://github.com/user-attachments/assets/fc450066-5fb1-4fd9-bfbd-7f2cd55ce855"></video>
| <video
src="https://github.com/user-attachments/assets/991f6a42-f6fe-479b-9f68-7e7e35dca799"></video>
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants