mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 13:06:00 +03:00
[PR #584] [MERGED] feat: Auto-focus on click (browser-like behavior) #1421
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#1421
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/584
Author: @eitanalka
Created: 1/25/2026
Status: ✅ Merged
Merged: 1/30/2026
Merged by: @kommander
Base:
main← Head:feature-auto-focus-on-click📝 Commits (10+)
8a0a76afeat(core): auto-focus on click (browser-like behavior)3c988bbMerge branch 'anomalyco:main' into feature-auto-focus-on-click688f0dfMerge branch 'main' into feature-auto-focus-on-clicke06b07aprettier441ff2efeat(core): make auto-focus cancelable via preventDefault6ccd6faMerge branch 'main' into feature-auto-focus-on-clickea973b5Merge branch 'main' into feature-auto-focus-on-click951ce56dispatchbd3b8dcmore coverage3cb160eMerge branch 'main' into feature-auto-focus-on-click📊 Changes
3 files changed (+264 additions, -5 deletions)
View changed files
📝
packages/core/src/renderer.ts(+24 -5)➕
packages/core/src/tests/renderer.focus.test.ts(+209 -0)📝
packages/core/src/tests/renderer.mouse.test.ts(+31 -0)📄 Description
Fixes Issue #576
Problem
Currently, clicking on a focusable element (input, scrollbox, etc.) doesn't automatically focus it. Users must manually handle
onMouseDownto set focus state, which is different from browser behavior.Proposed Solution
Add browser-like auto-focus behavior to the renderer:
focus()on the clicked elementisWithinContainerBenefits
onMouseDownhandlers needed)focusedBorderColor/focusedBackgroundColorstyle props🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.