Ujjwaljain16 opened a new pull request, #37978:
URL: https://github.com/apache/superset/pull/37978
### 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
* [x] Has associated issue: Fixes #37948
* [ ] Required feature flags
* [x] Changes UI
* [ ] Includes DB Migration
* [ ] Introduces new feature or API
* [ ] Removes existing feature or API
--
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]