question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Vinnlcommented, Feb 18, 2022

Thanks @snowystinger! And in case it’s useful for understanding use cases:

what is stopping you from using the translations that React Aria already has?

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 I18nProvider and passing it the locale we detected, I suppose.

0reactions
snowystingercommented, Feb 17, 2022

Team is fine with this simple case, I’ve opened a PR to address it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create an Alert with just one action button - Stack Overflow
Creates an alert with two buttons. init(title: Text, message: Text?, dismissButton: Alert.Button?) Creates an alert with one button.
Read more >
How to add actions to alert buttons - a free SwiftUI by Example ...
Basic SwiftUI alerts look like this: Alert( title: Text("Important message"), message: Text("Wear sunscreen"), dismissButton: . default(Text(" ...
Read more >
How to present an alert in SwiftUI in iOS 15 - Sarunw
Set the isPresented value to true will present the alert. ... I tried to style a text view and set a view other...
Read more >
Alerts · Bootstrap v5.0
Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative...
Read more >
Sheets - Presentation - Human Interface Guidelines - Design
For developer guidance, see detents. In an iPhone app, consider supporting the medium detent to allow progressive disclosure of the sheet's content. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found