yousoph opened a new pull request, #41100:
URL: https://github.com/apache/superset/pull/41100
## Summary
- `FilterInput` in the Results pane (`DataTableControl/index.tsx`)
auto-focuses on mount when `shouldFocus={true}` is set. It is always `true` in
`DataTableControls.tsx`.
- When a renderTrigger control like `legendMargin` is edited,
`queryFormData` changes → `cappedFormData` in `useResultsPane` is a new object
→ WeakMap cache miss → `setIsLoading(true)` → `SingleQueryResultPane`
unmounts/remounts → `FilterInput` re-mounts and steals focus from whatever the
user was editing.
- **Fix:** Guard `FilterInput.useEffect` to skip auto-focus if an INPUT,
TEXTAREA, or contenteditable element already has focus. Preserves the
auto-focus UX when the pane first opens (nothing is focused), prevents cursor
theft during re-mounts.
## Test plan
- [ ] In Explore, open a Bar Chart, go to the Customize tab, enter a value
in Legend margin, then clear it — cursor should stay in the legend margin field
- [ ] In Explore, open the Results pane for the first time — the search box
should still auto-focus
- [ ] Unit tests: `npx jest
src/explore/components/DataTableControl/FilterInput.test.tsx --no-coverage`
Fixes: https://app.shortcut.com/preset/story/108003
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]