sonner icon indicating copy to clipboard operation
sonner copied to clipboard

Setting props on list item

Open basickarl opened this issue 9 months ago • 2 comments

Describe the feature / bug 📝:

Hi, I'm trying to set the tabIndex value of the parent container to -1 of a toast item. As you see in the image below it is currently not at -1 and I cannot see how I can change this.

image

I believe the tab indexing is targeting the li element. Is there currently a way to set the props on a list item as this would fix the issue? I checked the API documentation and I don't see that it is possible.

It would be cool of it was done via something like this:

  toast(<div>A custom toast with default styling</div>, {
    duration: 5000,
    props: {
      tabIndex: -1,
    },
  });

This would only spread the props onto the list item and not affect any other toasts.

Steps to reproduce the bug 🔁:

  1. Create a custom toast via the custom code: https://sonner.emilkowal.ski/toast#custom
  2. Make the toast appear.
  3. Press tab, it will select the toast.

basickarl avatar May 20 '24 15:05 basickarl