-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature Request]: Add a "disableFocusTrap" prop to the ActionableNotification component #17392
Comments
Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team. |
Thanks for opening this issue and showing your use-case so clearly!
ActionableNotification is an As you saw in the related issues you linked, the initial addition of This is a challenging design problem. @carbon-design-system/design are there other options for this type of interaction? |
Ah, I didn't notice the references to the experimental Is the problem because the screen reader won't announce the initial appearance of a live region? The trick we've used in the past is to render the element in a live region that's empty and then use a |
@tay1orjones This is a bit of a tangent but is there a reason that |
Yeah, when a notification with interactive elements/actions is added to the DOM as a result of a user/system action, it needs to be both announced and able to be easily navigated to by a keyboard/screenreader user. The first part, announcement, is easy to do as you mention with your approach of an existing live region. The second piece, easily navigating to the notification, can be very difficult to solve and implement properly. Aiming to provide an accessible experience out of the box, the only way to do this right now is through an ActionableNotification
There is not a way for you to take on that complexity right now with ActionableNotification being locked to The StaticNotification/Callout intentionally does not have a close button because the design spec calls for it to not be dismissable. |
Yeah, letting us control the
I'm not sure if this is actually required but I'm not an a11y expert. What little I've read suggests there's just no hard rule here and I wonder if perhaps that means Carbon should just delegate this responsibility to the application. If the application wants to display a non-modal dialog then it needs to decide if it should be announced and if it does, the application can put it inside a live region. The application could also be responsible for putting the modal in a region to make it easier to navigate to. I don't know if Carbon wants to take a more specific enforcement opinion on these questions or be more out-of-the-box as you put it. I think we'll probably be okay with any of the region/announcement options as long as we can get a non-modal dialog that doesn't steal or trap focus. |
Waiting to chat with @mbgower in a future CAG (Carbon Accessibility Guild) call. |
Yeah, I think this can use a bit more discussion. |
We chatted about this today on the CAG call. Plan of action we came up with is below:
|
The problem
The ActionableNotification component is currently implemented to require a user to dismiss it before they can interact with the rest of the application. When an actionable notification is opened, it will immediately grab focus and then trap focus inside the notification until the notification is dismissed.
We have a use case where the notification is used for information purposes about asynchronous processes. The user triggers some action that completes later and the notification is used to inform the user the action is complete and it includes a button to take the user to that action to see the results. When an action is complete, is should be informational to the user and should not forcibly move or trap focus. There may even be multiple notifications. We know the current behavior is as designed and we would like a prop to allow us to control the behavior.
There is currently a
hasFocus
prop on the component now that disables the initial grabbing of focus but this prop is deprecated and even with that prop, the notification will still trap focus if focus is moved inside of it.Here are a few related issues discussing this problem:
#15319
#16231
The solution
Add something like a
disableFocusTrap
prop to the component that will disable both the initial grabbing of focus and the focus trap that occurs when elements inside the notification get focus.Examples
Here's a video showing a simplified example. The user is interacting with a chat bot that starts an asynchronous process. When the process complete, focus is moved away from the field while the user is in the middle of typing. Just recording this video was hard because I kept pressing the space bar as I was typing which just dismissed the notification immediately when it got focus.
Screen.Recording.2024-09-09.at.10.24.36.AM.mov
Application/PAL
No response
Business priority
None
Available extra resources
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: