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

Unwanted ghost click through the toast #64

Open
adrisanchu opened this issue Jan 12, 2023 · 0 comments
Open

Unwanted ghost click through the toast #64

adrisanchu opened this issue Jan 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@adrisanchu
Copy link

Explanation

By default, the toast is not selectable and you can click through (which is the desired effect in most cases).
However, when there are buttons or any other clickable element underneath the toast, a user click can lead to unwanted events being fired.

Proposed solution

In SvelteToast.svelte, add a new CSS variable allowing to control pointer-events property, keeping current behavior as default.

<style>
._toastContainer {
  /* rest of the props... */
  /* pointer-events: none; */
  pointer-events: var(--toastContainerPointerEvents, none);
}
</style>

pointer-events: auto; will avoid this "ghost effect".
Plus, it will allow to select the text within the toast with the mouse (which can be useful for copy/pasting!)

@zerodevx zerodevx added the enhancement New feature or request label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants