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

Fix Issue #244 #334

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

wherehows
Copy link

@wherehows wherehows commented Jan 14, 2024

Summary

"toast" method's toast messages, using the "error" or "success" properties, do not apply the configured "ariaProps" options in the Toaster component. Please refer to the following link for more details.

#244

Reason

When the "error" or "success" properties of the toast function are called, the createToast function is invoked. However, the issue lies in the fact that createToast defines default values for ariaProps.

const createToast = (
  message: Message,
  type: ToastType = 'blank',
  opts?: ToastOptions
): Toast => ({
  createdAt: Date.now(),
  visible: true,
  type,
  ariaProps: {
    role: 'status',
    'aria-live': 'polite',
  },
  message,
  pauseDuration: 0,
  ...opts,
  id: opts?.id || genId(),
});

This value is causing an issue by overriding the globally set ariaProps option

Solution

Firstly, I made ariaProps an optional property for the Toast type. (62df748)

Secondly, within the createToast, I removed the ariaProps that were initially defined. (7f85f4e)

Lastly, within the store, I created a variable named 'defaultAriaProps' to ensure default values are applied to ariaProps. (2949993)

Copy link

vercel bot commented Jan 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hot-toast ❌ Failed (Inspect) Jan 14, 2024 4:42am

@wherehows wherehows changed the title (WIP) Fix Issue #244 Fix Issue #244 Jan 14, 2024
@wherehows
Copy link
Author

@timolins I encountered an error on Vercel with this pull request, even though there were no issues during local testing and build. It's challenging to identify the cause of the problem. Could you please help me understand the reason for this error? If modifications are necessary, your guidance would be greatly appreciated.

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

Successfully merging this pull request may close these issues.

None yet

1 participant