reports icon indicating copy to clipboard operation
reports copied to clipboard

FB16539817: Safari does not provide public.html to system services

Open samhenrigold opened this issue 8 months ago • 0 comments

Submission Date

2025-02-21

Status

Open

Area

Safari

Operating System Version

macOS 15

Type

Incorrect/Unexpected Behavior

Description

When invoking a system service from Safari's context menu, Safari does not to supply the full HTML (public.html) representation on the pasteboard. Instead, only a limited set of types (plain text, RTF, etc.) is provided. However, performing a manual copy (Cmd-C) of the same selection places the expected public.html data on the pasteboard.

Expected Behavior:

Safari should supply the full HTML data (public.html) on the pasteboard when a system service is invoked via its context menu—same behavior as when manually copying.

A similar issue was mentioned on the developer forums in 2020: https://developer.apple.com/forums/thread/662695?answerId=640826022

Steps to Reproduce:

  1. Create a blank Cocoa app that registers an NSService with the following send types:    - public.utf8-plain-text      - public.html      - public.rtf

  2. Implement a service method that just logs the pasteboard types:        @objc func copyAsMarkdown(_ pasteboard: NSPasteboard, userData: String?, error: AutoreleasingUnsafeMutablePointer<NSString>) {        print(pasteboard.types)    }    

  3. Build and install the app as a service.

  4. In Safari, select some content on a webpage, right-click, and run the service.

  5. The logged pasteboard types do not include public.html:        Optional([__C.NSPasteboardType(_rawValue: public.utf8-plain-text), __C.NSPasteboardType(_rawValue: NSStringPboardType), __C.NSPasteboardType(_rawValue: public.rtf), __C.NSPasteboardType(_rawValue: NeXT Rich Text Format v1.0 pasteboard type), __C.NSPasteboardType(_rawValue: public.utf16-external-plain-text), __C.NSPasteboardType(_rawValue: CorePasteboardFlavorType 0x75743136)])    

  6. Manually copy the same selection in Safari. When checking the pasteboard (with a utility like Pasteboard Viewer or similar), the public.html flavor is available.

Keywords

NSService

Prerequisites

  • [x] The title follows the format FB<number>: <title>
  • [x] I will keep this issue updated with Apple's responses

samhenrigold avatar Apr 24 '25 14:04 samhenrigold