Allow setting the text content of a DismissButton
See original GitHub issue🙋 Feature Request
Currently a <DismissButton> renders a <button> with its aria-label set to “Dismiss”. Possibly this will get localised automatically when using react-aria’s internationalisation support, but it doesn’t seem to be otherwise customisable. (If it is, this is a request for documentation 😃 )
🤔 Expected Behavior
Be able to pass a custom string to give to the user. If no string is passed, current behaviour is preserved.
😯 Current Behavior
It just automatically renders “Dismiss”.
💁 Possible Solution
One possible approach is just re-using the aria-label attribute set on <DismissButton> directly. Another approach might be using its children, though that might imply that it’s possible to set it to more than a string.
🔦 Context
We’re using other l10n tooling (Fluent, to be specific), so now we can’t localise this specific element.
💻 Examples
🧢 Your Company/Team
🎁 Tracking Ticket (optional)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Thanks @snowystinger! And in case it’s useful for understanding use cases:
I’m not sure if react-aria’s language detection resolves to the same languages we have, whether it has the same locales available as we do, and perhaps vice versa, that it doesn’t translate the strings we don’t either. Which, writing it out like this, can be partially resolved by adding react-aria’s
I18nProviderand passing it the locale we detected, I suppose.Team is fine with this simple case, I’ve opened a PR to address it