Add keyboard event handlers to fix mouse-events-have-key-events accessibility warning#10407
Conversation
…ccessibility warning
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesFocus/blur active state for ValidationErrorBoundary
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
features/admin.flow-builder-core.v1/components/validation-panel/validation-error-boundary.tsx (1)
104-117:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winAdd
tabIndexto make the wrapper focusable for keyboard users.The
onFocusandonBlurhandlers won't fire from keyboard navigation because<div>elements are not focusable by default. WithouttabIndex={0}, keyboard users pressing Tab won't be able to focus this element, and the accessibility fix won't work as intended.♿ Proposed fix to enable keyboard focus
<div className={ classNames( { active: hasNotification && active && disableErrorBoundaryOnHover, [ notificationType ]: hasNotification && !!notificationType, padded: hasNotification && !disableErrorBoundaryOnHover, "validation-error-boundary": hasNotification } ) } data-componentid={ componentId } + tabIndex={ hasNotification ? 0 : undefined } onMouseOver={ () => hasNotification && disableErrorBoundaryOnHover && setActive(true) } onMouseOut={ () => hasNotification && disableErrorBoundaryOnHover && setActive(false) } onFocus={ () => hasNotification && disableErrorBoundaryOnHover && setActive(true) } onBlur={ () => hasNotification && disableErrorBoundaryOnHover && setActive(false) } >Note:
tabIndex={0}is conditionally applied only when there's a notification, so the wrapper only enters the tab order when it has validation errors to display.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/admin.flow-builder-core.v1/components/validation-panel/validation-error-boundary.tsx` around lines 104 - 117, The `<div>` element with onFocus and onBlur handlers is not focusable via keyboard navigation because div elements are not focusable by default. Add a tabIndex prop to the div element in the validation-error-boundary component and conditionally set it to 0 when hasNotification is true. This will allow keyboard users to focus the element via Tab navigation, enabling the onFocus and onBlur accessibility handlers to work as intended.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@features/admin.flow-builder-core.v1/components/validation-panel/validation-error-boundary.tsx`:
- Around line 104-117: The `<div>` element with onFocus and onBlur handlers is
not focusable via keyboard navigation because div elements are not focusable by
default. Add a tabIndex prop to the div element in the validation-error-boundary
component and conditionally set it to 0 when hasNotification is true. This will
allow keyboard users to focus the element via Tab navigation, enabling the
onFocus and onBlur accessibility handlers to work as intended.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: bf6e65d6-46b4-4c7d-bc21-e49847ccaeb0
📒 Files selected for processing (1)
features/admin.flow-builder-core.v1/components/validation-panel/validation-error-boundary.tsx
Purpose
Fix react-doctor/mouse-events-have-key-events accessibility warning by pairing onMouseOver and onMouseOut handlers with their keyboard equivalents onFocus and onBlur in ValidationErrorBoundary.
Related Issues
Related PRs
Checklist
e2e cypress tests locally verified.(for internal contributers)UX/UI review done on the final implementation.Documentation provided. (Add links if there are any)Relevant backend changes deployed and verifiedUnit tests provided. (Add links if there are any)Integration tests provided. (Add links if there are any)Security checks
Ran FindSecurityBugs plugin and verified reportDeveloper Checklist (Mandatory)
product-isissue to track any behavioral change or migration impact.