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

Cannot set OverlaySettings to IgxToast, IgxSnackbar #14934

Open
RivaIvanova opened this issue Oct 22, 2024 · 1 comment
Open

Cannot set OverlaySettings to IgxToast, IgxSnackbar #14934

RivaIvanova opened this issue Oct 22, 2024 · 1 comment

Comments

@RivaIvanova
Copy link
Member

Description

The documentation states that both components use "Overlay Settings to control the position of its container. The default settings can be changed by defining Custom OverlaySettings and passing them to the open() method."

public customSettings: OverlaySettings = {
    positionStrategy: new GlobalPositionStrategy(
        { 
            horizontalDirection: HorizontalAlignment.Left,
            verticalDirection: VerticalAlignment.Top
        }),
    modal: true,
    closeOnOutsideClick: true,
};

toast.open(customSettings);
snackbar.open(customSettings);

Toast Overlay Settings docs & Snackbar Overlay Settings docs.

However, none of the open methods accept OverlaySettings as a parameter. (toast open(), snackbar open())

// toast
public override open(message?: string, settings?: PositionSettings) {
   ...
}

// snackbar
public override open(message?: string) {
   ...
}
  • igniteui-angular version: master, 18.1, 17.2
  • browser:

Steps to reproduce

  1. Define custom OverlaySettings and pass them to the open() method.

Result

Cannot set OverlaySettings to IgxToast, IgxSnackbar.

Expected result

Should be able to set OverlaySettings to IgxToast, IgxSnackbar.

@damyanpetev
Copy link
Member

damyanpetev commented Oct 31, 2024

@RivaIvanova @SisIvanova
Outside of what the docs say (which is obviously not correct), is there an actual need for some use case that requires anything from the full OverlaySettings? That's keeping in mind both components expose the outlet and PositionSettings atm.

From what I can tell, those already cover most needs and the other settings don't entirely make sense for those more specialized components - i.e. I don't think we care to have a positioned toast around a target or a modal one. These components are not intended for active interaction either, so close on outside click and escape also don't make too much sense. That doesn't leave much else useful from the settings, so this could be a case of just correcting the documentation.

PS: What might be useful for the Toast/Snackbar would be if we had a way to utilize the Container strategy instead of just Global (perhaps based on outlet use) and if the user-provided position settings were merged with defaults :)
Edit: Oh just noticed from the changes in #10133 that the Snackbar does use ContainerPositionStrategy so that's good. And I can only assume/hope the narrowing of exposed options was intentional here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants