-
Notifications
You must be signed in to change notification settings - Fork 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
fix: Rules > Detection (SEIM) Rules][SCREEN READER]: Snooze notifications modal is not trapping VoiceOver + Safari properly #182670
Conversation
…ions modal is not trapping VoiceOver + Safari properly Closes: elastic/security-team#8716
/ci |
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management) |
try { | ||
await onRuleChanged(...args); | ||
} finally { | ||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for adding this timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cnasikas the rendering cycle after calling await onRuleChanged(...args)
must complete for the reference to focusTrapButtonRef
to be updated. It might work without setTimeout
, but I can't be certain it will work stable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a timeout in the callback without React being aware may cause various issues. For example, the timeout will not be cleaned if the user navigates to another page and the component unmounts. Moving the focusTrapButtonRef.current?.focus()
to a useEffect
that will trigger every time the rule is updated seems more appropriate. I am curious about the UX of a user using the mouse. Will it focus the button also for them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JiaweiWu proposed the usage of requestAnimationFrame
. It is being used by the EUI library (https://github.com/elastic/eui/blob/main/packages/eui/src/components/inline_edit/inline_edit_form.tsx#L242) Also, could autofocus
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that we pass the same focusTrapButtonRef
to all buttons. Is that supported or does the reference hold the last button only?
Also, I noticed that if I set a schedule with the mouse the button will be focused and show a tooltip. Is this a behavior we want to do for users who do not navigate with the keyboard? @mdefazio Any opinion on this? Screen.Recording.2024-05-20.at.12.06.20.PM.mov |
@cnasikas Please correct me if I'm wrong. If I understand the business logic correctly, the After calling How does that solution work? : As I mentioned at the beginning, in the UI we can have only one of the three buttons at a time. This means that if I set a single reference to all three buttons, this reference will ultimately point to the currently rendered element. Then, after calling Regarding the |
Thank you @alexwizp for your detailed answer and your patience with me.
This was not clear to me. Thanks for clarifying!
I am ok with the change. Let's wait for @mdefazio to hear his opinion on this before merging. Other than that LGTM! |
@cnasikas Thanks for the ping. I don't think showing the tooltip/keeping focus on the button is bad here. And since this is our default button behavior anyway, let's wait on doing anything extra here. |
Closes: https://github.com/elastic/security-team/issues/8716
Description
The Detection Rules table has a Snooze notifications modal that is not trapping focus consistently in Safari + VoiceOver. The focus is being "bounced" to the
<main>
container when I traverse usingCtrl + Opt + RIGHT_ARROW
or quick arrow navigation methods. These are the default VO navigation methods. This is not affecting Chrome + JAWS or Firefox + NVDA. Screenshot and MOV attached below.Steps to recreate
Ctrl + Opt + Enter
to open itCtrl + Opt + Right_Arrow
What was done?
Screen:
Screen.Recording.2024-05-06.at.15.18.34.mov