-
Notifications
You must be signed in to change notification settings - Fork 448
fix: image preview a11y #7252
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: image preview a11y #7252
Changes from all commits
8beb899
21165e1
ec31a62
28380fc
24900ee
e0bad5c
f75e95d
85bf28d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| <div | ||
| v-else | ||
| ref="nodeContainerRef" | ||
| tabindex="0" | ||
| :data-node-id="nodeData.id" | ||
| :class=" | ||
| cn( | ||
|
|
@@ -16,7 +17,7 @@ | |
| // hover (only when node should handle events) | ||
| shouldHandleNodePointerEvents && | ||
| 'hover:ring-7 ring-node-component-ring', | ||
| 'outline-transparent outline-2', | ||
| 'outline-transparent outline-2 focus-visible:outline-node-component-outline', | ||
| borderClass, | ||
| outlineClass, | ||
| cursorClass, | ||
|
|
@@ -48,6 +49,7 @@ | |
| @dragover.prevent="handleDragOver" | ||
| @dragleave="handleDragLeave" | ||
| @drop.stop.prevent="handleDrop" | ||
| @keydown="handleNodeKeydown" | ||
| > | ||
|
Comment on lines
+52
to
53
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard node-level key forwarding so arrow keys in inputs/widgets don’t trigger gallery navigation. Concrete guard (also reduces pointless updates for keys nobody consumes): const handleNodeKeydown = (event: KeyboardEvent) => {
- keyEvent.value = event
+ // Don’t steal cursor keys from inputs / editable content inside the node
+ const target = event.target as HTMLElement | null
+ if (
+ target?.closest(
+ 'input, textarea, select, [contenteditable="true"], [role="textbox"]'
+ )
+ ) {
+ return
+ }
+
+ // Optional: only forward keys preview cares about
+ // if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) return
+
+ keyEvent.value = event
}Based on learnings, this still preserves the intended “node-focused navigation” behavior while avoiding accidental interception. Also applies to: 214-216 🤖 Prompt for AI Agents |
||
| <div class="flex flex-col justify-center items-center relative"> | ||
| <template v-if="isCollapsed"> | ||
|
|
@@ -130,7 +132,16 @@ | |
|
|
||
| <script setup lang="ts"> | ||
| import { storeToRefs } from 'pinia' | ||
| import { computed, nextTick, onErrorCaptured, onMounted, ref, watch } from 'vue' | ||
| import { | ||
| computed, | ||
| nextTick, | ||
| onErrorCaptured, | ||
| onMounted, | ||
| provide, | ||
| ref, | ||
| shallowRef, | ||
| watch | ||
| } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| import type { VueNodeData } from '@/composables/graph/useGraphNodeManager' | ||
|
|
@@ -197,6 +208,13 @@ const isSelected = computed(() => { | |
| return selectedNodeIds.value.has(nodeData.id) | ||
| }) | ||
|
|
||
| const keyEvent = shallowRef<KeyboardEvent | null>(null) | ||
| provide('keyEvent', keyEvent) | ||
|
|
||
| const handleNodeKeydown = (event: KeyboardEvent) => { | ||
| keyEvent.value = event | ||
| } | ||
simula-r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const nodeLocatorId = computed(() => getLocatorIdFromNodeData(nodeData)) | ||
| const { executing, progress } = useNodeExecutionState(nodeLocatorId) | ||
| const executionStore = useExecutionStore() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.