lapcat / SafariExtensions

Resources for the development of Safari extensions
43 stars 3 forks source link

FB11843792 - Safari doesn't enable Paste and Match Style in extension popups #13

Open lapcat opened 1 year ago

lapcat commented 1 year ago

If your Safari app extension popup has an NSTextView, Safari doesn't enable Paste and Match Style, even though it enables Paste. See the attached screenshot.

Screen Shot 2022-12-02 at 11 08 39 AM

In my testing and debugging, I don't even see validateMenuItem: get called at all for Paste and Match Style. This bug affects my Safari extension in the Mac App Store. It's especially problematic because some users reverse the keyboard shortcuts of the two menu items Paste and Paste and Match Style in Safari to get ⌘V for the latter. Thus, that keyboard shortcut won't work for them in the Safari extension popup.

Steps to reproduce: 1) Unzip, build, and run the attached sample Xcode project PasteAndMatchStyleTest 2) Enable the Safari extension 3) Copy some text 4) Open the Safari extension popup

Expected results: Paste and Match Style is enabled.

Actual results: Paste and Match Style is not enabled.

PasteAndMatchStyleTest.zip