fix : make the KeyHandler work in the Validation story#1027
Conversation
WalkthroughValidation story text and interaction were changed: description now states validation runs after each change and shows errors for invalid graphs; instructions to delete selected cells with the [DELETE] key were added; a TODO about DELETE behavior was removed; the graph container is made keyboard-focusable ( ChangesValidation story updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
🧹 Nitpick comments (1)
packages/html/stories/Validation.stories.ts (1)
186-188: Consider focusing the iframe window before focusing the containerIn Storybook iframe scenarios,
container.focus()alone can still be flaky for keyboard delivery. Addwindow.focus()in the same click handler for better reliability.Based on learnings: "KeyHandler issues in Storybook are due to iframe isolation - ... ensure the iframe window has focus by calling window.focus() and focusing the target element in the preview configuration or story setup."Suggested patch
- container.addEventListener('click', () => { - container.focus(); - }) + container.addEventListener('click', () => { + window.focus(); + container.focus(); + });
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 05861f1c-e2e2-4b42-91c9-21be26ab003b
📒 Files selected for processing (1)
packages/html/stories/Validation.stories.ts
|
|



PR Checklist
maxGraph, and you are assigned to the issue.packages/core/_tests_or a new or altered Storybook story inpackages/html/stories(an existing story may also demonstrate the change).Overview
In stories involving keyboard events, they don't seem to be registered and propagated to the graph container, and are thus not handled.
This pull request is intended to cover #910, although this issue is present on all stories which involve the handling of keyboard events by the graph.
Analysis
containerHTML element linked to the graph has no tabindex attribute.Notes
Keywords
Covers #910
Summary by CodeRabbit
New Features
Accessibility