Skip to content

Conversation

@wellingtoncosta
Copy link
Collaborator

@wellingtoncosta wellingtoncosta commented Jan 6, 2026

Summary

Implements cursor hiding behavior on macOS when typing in text fields, matching the native IDE behavior. The cursor automatically hides when the user types and reappears when the mouse moves.

Evidence

Screen.Recording.2026-01-06.at.6.37.57.PM.mov

Implementation Details

Architecture

Added a platform-specific cursor controller abstraction using Compose composition locals:

  • PlatformCursorController - Interface for platform-specific cursor control
  • StandalonePlatformCursorController - macOS implementation using JNA to call [NSCursor setHiddenUntilMouseMoves:YES]
  • BridgePlatformCursorController - Bridge implementation using MacUIUtil.hideCursor()
  • NoOpPlatformCursorController - Fallback for unsupported platforms

Integration

  • Applied to all InputField components via .hideCursorOnTyping() modifier
  • Only active when field is enabled and not read-only
  • Provided via LocalPlatformCursorController composition local:
    • IntUiThemeStandalonePlatformCursorController
    • SwingBridgeThemeBridgePlatformCursorController

Release notes

New features

  • Input Fields: Added automatic cursor hiding on macOS when typing. The cursor hides while typing and reappears when the mouse moves, matching the native macOS behavior seen in IntelliJ Platform text fields (JEWEL-992).

Copy link
Collaborator

@faogustavo faogustavo left a comment

Choose a reason for hiding this comment

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

No blockers :)

@wellingtoncosta wellingtoncosta force-pushed the wp/hide-cursor-while-typing-macos branch from 3c1838d to 8f771d3 Compare January 7, 2026 14:34
import org.jetbrains.skiko.OS
import org.jetbrains.skiko.hostOs

internal object StandalonePlatformCursorController : PlatformCursorController {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is copied from platform code, it'd be good to write it in the KDoc

import org.jetbrains.jewel.ui.platform.PlatformCursorController

@Composable
public fun Modifier.hideCursorOnTyping(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we make it internal? I don't think people will need to use this directly.

import androidx.compose.runtime.ProvidableCompositionLocal
import androidx.compose.runtime.staticCompositionLocalOf

public interface PlatformCursorController {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add KDoc to all public API symbols

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants