Skip to content

macOS: NSOpenPanel appears to linger invisibly after closing and still shows filename tooltips #437

@tangshimin

Description

@tangshimin

Summary

On macOS, after picking a file with the FileKit file picker (using FileKitType.File(...) with multiple extensions), the picker window seems to remain invisibly on screen even after it visually closes. When the cursor hovers over the area where the dialog previously was, macOS tooltips for the files (long filenames) still appear, as if the NSOpenPanel is still present and hit-testing events. This can also be observed after switching to another app.

This does not seem to happen when using FileKitType.Image.

Affected

  • Platform: macOS (Compose Multiplatform desktop)
  • Type(s): FileKitType.File(...) with multiple extensions (e.g., "txt", "log", or "jpg", "png")
  • Mode: Single file selection (also reproducible in multiple selection)

Why this is tricky to reproduce

The tooltip appears only when macOS decides to show a filename tooltip. That typically happens with long filenames and when there are multiple items in view. Therefore, the key is to use a folder that contains multiple files with long names.

Steps to reproduce

  1. Prepare a folder that contains at least 5–10 files, each with a long filename (40–80+ characters, underscores/spaces help). Example names:
    • filename_for_testing_tooltip_visibility_issue_number_01.txt
    • filename_for_testing_tooltip_visibility_issue_number_02.txt
    • ... (more files with similarly long names)
  2. In the sample app (Compose), use a file picker with multiple extensions, e.g.:
    • FileKitType.File(extensions = arrayOf("txt", "log")) (or arrayOf("jpg", "png")).
  3. Run the desktop sample and open the single file picker. Navigate to the prepared folder.
  4. Select any file so the picker closes.
  5. Switch to another application (e.g., Finder/Safari).
  6. Move the mouse cursor over the area of the screen where the file picker window used to be.

Observed: after a few tries, macOS shows a tooltip with the full (long) file name, as if the picker were still present and receiving hover events.

Expected behavior

  • Once the file picker closes, it should not capture any mouse events and no tooltips should appear in the area it previously occupied.

Actual behavior

  • The picker visually disappears, but an invisible layer (likely from NSOpenPanel or one of its subviews) seems to still participate in hit-testing and shows filename tooltips for items that were displayed in the panel.

Minimal example (using samples)

sample-3.mov

In samples/sample-compose/composeApp/src/commonMain/kotlin/App.kt, configure the single file picker to allow multiple extensions, for example:

val singleFilePicker = rememberFilePickerLauncher(
    // type = FileKitType.Image,
    type = FileKitType.File(extensions = arrayOf("txt","log")),
    title = "Single file picker",
    directory = directory,
    onResult = { file -> file?.let { files += it } },
    dialogSettings = dialogSettings
)

Then run the desktop app and follow the reproduction steps above (use the folder with multiple long-filename files).

Environment

  • macOS:15.7
  • JDK: 21
  • Compose Multiplatform (desktop)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions