Skip to content

Notices - __unstableHTML works for default, but not in snackbar #56767

@albanyacademy

Description

@albanyacademy

Description

__unstableHTML works for generic notices, but it doesn't seem to apply to snackbar, even though it's listed as an option in the docs.

E.g.

if ( val.indexOf( '<a' ) > -1 ) {
	dispatch( 'core/notices' ).createNotice(
		'warning',
		`<strong>Illegal Tags</strong>Removed embedded link in button text: ${ val }`,
		{
                       	type: 'snackbar',
			isDismissible: true,
			__unstableHTML: true,
		},
	);
}

Spits out html as string.

image

Omitting the type:'snackbar' argument results in:
image
(which, admittedly, doesn't do exactly what i need it to in this screenshot, but you get the drift)

Can even replicate in storybook https://wordpress.github.io/gutenberg/?path=/docs/components-snackbar--docs -
image

Step-by-step reproduction instructions

Create a snackbar notice
Use HTML in string, add __unstableHTML flag
???

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Package] Components/packages/components[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions