Skip to content

fix(dashboard): restore arrow key navigation in modal inputs opened from dropdown#37978

Open
Ujjwaljain16 wants to merge 2 commits into
apache:masterfrom
Ujjwaljain16:fix/modal-input-keyboard-nav
Open

fix(dashboard): restore arrow key navigation in modal inputs opened from dropdown#37978
Ujjwaljain16 wants to merge 2 commits into
apache:masterfrom
Ujjwaljain16:fix/modal-input-keyboard-nav

Conversation

@Ujjwaljain16

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes an issue where Arrow (Left/Right), Home, and End keys did not work inside input fields in modals opened from the dashboard header dropdown (e.g., “Save as” dashboard modal and “Theme & CSS” modal).

Root Cause

ModalTrigger.open() called e.preventDefault(), which interfered with Ant Design’s Menu click handling. As a result, the parent Dropdown did not properly close when the modal opened.

Since the dropdown remained mounted in the DOM, rc-menu’s internal keyboard navigation handler continued intercepting navigation keys (Arrow, Home, End) for ARIA menu navigation. This prevented normal cursor movement inside modal input fields.

Alphanumeric typing was unaffected because rc-menu only intercepts navigation keys.

Fix

Replaced e.preventDefault() with e.stopPropagation() in ModalTrigger.open().

This ensures:

  • The click event completes normally, allowing the dropdown to close.
  • The event does not bubble unnecessarily to higher-level handlers.
  • Modal input fields regain normal keyboard navigation behavior.

This is a minimal and safe change limited to click handling within ModalTrigger.


BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable (keyboard navigation behavior change).


TESTING INSTRUCTIONS

Manual verification:

  1. Open any dashboard (View or Edit mode).

  2. Click the triple-dot menu in the top-right.

  3. Select “Save as”.

  4. In the “Dashboard name” input:

    • Type text.
    • Press Left/Right arrow keys → cursor should move correctly.
    • Press Home/End → cursor should jump to start/end.
  5. Close the modal.

  6. Open Settings → Theme & CSS.

  7. Repeat arrow/Home/End key checks in the Theme name input.

  8. Re-open the dashboard dropdown and verify:

    • Dropdown closes correctly when selecting items.
    • Other menu items behave normally.

Automated tests:

  • Existing ModalTrigger tests pass.

  • Added regression tests verifying:

    • stopPropagation() is used instead of preventDefault().
    • Keyboard events inside modal inputs are not default-prevented.

ADDITIONAL INFORMATION

@bito-code-review

bito-code-review Bot commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #e6b531

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 5b817f5..5b817f5
    • superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/ModalTrigger.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Feb 14, 2026
@Ujjwaljain16

Copy link
Copy Markdown
Contributor Author

/review

@bito-code-review

bito-code-review Bot commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #50bd80

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 5b817f5..e21eed0
    • superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/ModalTrigger.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

bito-code-review Bot commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #4d3257

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 5b817f5..e21eed0
    • superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/ModalTrigger.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas requested a review from EnxDev February 24, 2026 18:28
@Ujjwaljain16

Copy link
Copy Markdown
Contributor Author

Can this pr be reviewed ?
@rusackas
@EnxDev

@chkang-idk2

chkang-idk2 commented Apr 3, 2026

Copy link
Copy Markdown

I tested it in versions 6.0 and 6.1, but the key still doesn't work. Could I have applied something incorrectly?

However, it seems to function properly after changing it to the code below.

superset-frontend/src/dashboard/components/SaveModal.tsx

          <Form.Item style={{ marginBottom: theme.sizeUnit }}>
            <Input
              placeholder={t('[dashboard name]')}
              value={newDashName}
              onFocus={e => handleNameChange(e.target.value)}
              onChange={e => handleNameChange(e.target.value)}
              onKeyDownCapture={e => {
                const keysToAllow = [
                  'Home',
                  'End',
                  'ArrowLeft',
                  'ArrowRight',
                  'ArrowUp',
                  'ArrowDown',
                ];
                if (keysToAllow.includes(e.key)) e.stopPropagation();
              }}
            />
          </Form.Item>

This only makes the dashboard name input field work; it does not resolve the issues with the other input fields.

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the writeup. A few concerns before this lands:

  1. The new tests don't exercise the bug. Both render ModalTrigger in isolation, but the issue only manifests when it's nested inside Dropdown > Menu > Menu.Item. Neither test would catch a regression. The first one also pins implementation details (stopPropagation called, preventDefault not) rather than behavior. Could you replace them with a test that renders the actual dropdown-menu structure and asserts the dropdown closes + keys reach the input?

  2. @chkang-idk2's comment is worth addressing. They tested on 6.0/6.1 and report the keys still don't work with this approach. Could you confirm via DevTools that after the click, the dropdown's aria-expanded flips to false and focus moves into the modal input? If it doesn't, the root cause may be focus management rather than event propagation, and the fix is incomplete.

  3. ModalTrigger is generic and widely used. Worth a git blame on the original preventDefault() to see why it was added — if triggerNode ever contains an anchor or sits in a form, dropping it changes behavior for callers outside this PR's scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend packages size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arrow keys, Home, and End keys not working in "Save as" dashboard title input

3 participants