codeant-ai-for-open-source[bot] commented on code in PR #41551:
URL: https://github.com/apache/superset/pull/41551#discussion_r3689522100
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx:
##########
@@ -703,6 +829,44 @@ const DashboardBuilder = () => {
className="dashboard-content"
editMode={editMode}
marginLeft={dashboardContentMarginLeft}
+ data-test="dashboard-grid-gate"
+ aria-disabled={isVersionPreviewActive}
+ previewGated={isVersionPreviewActive}
+ onKeyDownCapture={event => {
+ if (!isVersionPreviewActive) {
+ return;
+ }
+ // pointer-events: none leaves the subtree tab-focusable, so
+ // focus-navigation keys must pass through — swallowing Tab
+ // would trap keyboard focus inside the gated grid
+ // (WCAG 2.1.2). Activation/typing keys stay blocked outside
+ // the tab navs, which remain interactive during preview.
+ if (event.key === 'Tab' || event.key === 'Escape') {
+ return;
+ }
+ // Scrolling is not interaction. A mouse user can still scroll a
+ // gated preview with the wheel, so blocking the keyboard
+ // equivalent would leave a long dashboard unreadable by
+ // keyboard alone (WCAG 2.1.1).
+ if (SCROLL_KEYS.has(event.key)) {
+ return;
+ }
+ // Space scrolls too, but only where it would not also press
+ // something: the gate exists to stop activation, and
+ // pointer-events does not cover the keyboard.
+ if (
+ event.key === ' ' &&
+ !(event.target as HTMLElement).closest(
+ 'a, button, input, select, textarea, [role="button"],
[tabindex]:not([tabindex="-1"])',
+ )
+ ) {
+ return;
+ }
+ if (!(event.target as HTMLElement).closest('.ant-tabs-nav')) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }}
Review Comment:
**Suggestion:** The preview gate prevents default keyboard activation for
every focused element inside the dashboard content unless it is inside
`.ant-tabs-nav`. Because `pointer-events: none` does not remove elements from
the keyboard focus order, chart accessibility controls and custom dashboard
components can still receive focus but Enter, Space, and other required
interaction keys are swallowed, leaving keyboard users with apparently
focusable but unusable controls. Apply the gate only to the interactive chart
content or use a focus-management approach that does not expose blocked
controls as focusable. [incorrect condition logic]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Keyboard users can focus unusable dashboard controls.
- ⚠️ Chart and Markdown links cannot activate during preview.
- ⚠️ Custom component keyboard interactions are suppressed unexpectedly.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=951cfd15d1084ac99beda9ff84e0e8e4&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=951cfd15d1084ac99beda9ff84e0e8e4&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx
**Line:** 865:869
**Comment:**
*Incorrect Condition Logic: The preview gate prevents default keyboard
activation for every focused element inside the dashboard content unless it is
inside `.ant-tabs-nav`. Because `pointer-events: none` does not remove elements
from the keyboard focus order, chart accessibility controls and custom
dashboard components can still receive focus but Enter, Space, and other
required interaction keys are swallowed, leaving keyboard users with apparently
focusable but unusable controls. Apply the gate only to the interactive chart
content or use a focus-management approach that does not expose blocked
controls as focusable.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41551&comment_hash=fb621d3834409b28c826ef584c34be969524ad7c993961974aa818ac36727892&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41551&comment_hash=fb621d3834409b28c826ef584c34be969524ad7c993961974aa818ac36727892&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]