Skip to content

ADFA-3530 | Fix tooltip focus stealing and extract hover delay constant#1160

Merged
jatezzz merged 1 commit intostagefrom
fix/ADFA-3530-tooltip-focus
Apr 8, 2026
Merged

ADFA-3530 | Fix tooltip focus stealing and extract hover delay constant#1160
jatezzz merged 1 commit intostagefrom
fix/ADFA-3530-tooltip-focus

Conversation

@jatezzz
Copy link
Copy Markdown
Collaborator

@jatezzz jatezzz commented Apr 7, 2026

Description

Added a requestFocus parameter to ToolTipManager functions (defaulting to true) to control whether tooltip popups steal window focus. Disabled this focus request for tooltips triggered in EditorHandlerActivity. Additionally, extracted the hardcoded 600ms hover delay into a TOOLTIP_HOVER_SHOW_DELAY_MS constant within ProjectActionsToolbar for better readability and maintenance.

Details

document_5093693164217173759.mp4

Ticket

ADFA-3530

@jatezzz jatezzz marked this pull request as draft April 7, 2026 22:11
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e8e85b9e-d754-4115-b8be-fcbb96fa1dca

📥 Commits

Reviewing files that changed from the base of the PR and between 346268b and dfb066e.

📒 Files selected for processing (3)
  • app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt
  • common/src/main/java/com/itsaky/androidide/ui/ProjectActionsToolbar.kt
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt
✅ Files skipped from review due to trivial changes (1)
  • app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • common/src/main/java/com/itsaky/androidide/ui/ProjectActionsToolbar.kt
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt

📝 Walkthrough

Release Notes - ADFA-3530

Changes

  • Tooltip Focus Control: Added optional requestFocus parameter (defaults to true) to TooltipManager.showIdeCategoryTooltip() and showTooltip() to allow callers to prevent tooltips from stealing window focus
  • Focus Behavior in Editor: Disabled focus request for tooltips shown in EditorHandlerActivity to prevent interrupting editor input during hover actions
  • Code Quality: Extracted hardcoded 600ms hover delay into TOOLTIP_HOVER_SHOW_DELAY_MS constant in ProjectActionsToolbar for improved maintainability

Potential Risks & Considerations

  • Default Behavior: The requestFocus parameter defaults to true, which maintains backward compatibility for existing tooltip calls but may preserve focus-stealing behavior in other parts of the codebase not covered by this PR. Audit other tooltip invocations to determine if they should also disable focus requests.
  • Incomplete Coverage: Only EditorHandlerActivity has been updated to pass requestFocus = false. Review whether other UI components (e.g., toolbars, context menus, dialogs) should similarly disable tooltip focus stealing to provide a consistent UX pattern.

Walkthrough

Adds a requestFocus: Boolean = true parameter to TooltipManager APIs to control popup focusability; threads the flag through internal tooltip creation and "See more" navigation. Editor hover calls now pass requestFocus = false. Extracts a hover-show delay constant in ProjectActionsToolbar.

Changes

Cohort / File(s) Summary
Tooltip System
idetooltips/src/main/java/.../ToolTipManager.kt
Added requestFocus: Boolean = true to showIdeCategoryTooltip and showTooltip, threaded parameter through internal helpers and "See more" navigation, and set popupWindow.isFocusable = requestFocus.
Editor Hover Usage
app/src/main/java/.../EditorHandlerActivity.kt
Updated hover tooltip invocation to pass requestFocus = false when calling TooltipManager.showIdeCategoryTooltip.
Hover Timing
common/src/main/java/.../ProjectActionsToolbar.kt
Extracted hardcoded 600L hover delay into private const val TOOLTIP_HOVER_SHOW_DELAY_MS = 600L and replaced inline usage.

Sequence Diagram(s)

sequenceDiagram
    participant Toolbar as ProjectActionsToolbar / EditorHandlerActivity
    participant Manager as TooltipManager
    participant Popup as TooltipPopupWindow
    participant User as User

    Toolbar->>Manager: onHover -> showIdeCategoryTooltip(tag, requestFocus=false)
    Manager->>Popup: create popup (isFocusable = requestFocus)
    Popup-->>Manager: popup shown
    User->>Popup: interacts (e.g., "See more")
    Popup->>Manager: request deeper tooltip (propagate requestFocus)
    Manager->>Popup: replace/show deeper tooltip (focus per requestFocus)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • itsaky-adfa
  • jomen-adfa
  • Daniel-ADFA

Poem

🐇 I nibble on code beneath the moonlit scope,

Tooltips now whisper without stealing focus' hope;
Hover stays gentle, clicks may take the stage,
A constant for timing, neater lines on the page.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: fixing tooltip focus stealing and extracting a hover delay constant, which match the actual changeset modifications.
Description check ✅ Passed The description is directly related to the changeset, detailing the requestFocus parameter addition, disabling focus in EditorHandlerActivity, and extracting the hover delay constant.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ADFA-3530-tooltip-focus

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jatezzz jatezzz marked this pull request as ready for review April 8, 2026 13:45
Extracts hover delay constant and disables focus request for editor action tooltips.
@jatezzz jatezzz force-pushed the fix/ADFA-3530-tooltip-focus branch from 4cea006 to dfb066e Compare April 8, 2026 13:45
@jatezzz jatezzz merged commit c0364b3 into stage Apr 8, 2026
2 checks passed
@jatezzz jatezzz deleted the fix/ADFA-3530-tooltip-focus branch April 8, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants