NSSearchField dimensions vs Big Sur = regression

In macOS Big Sur, the dimensions of the NSSearchField control have changed. For the worst, of course.

Previously, in macOS Mojave or Catalina, when using a small NSSearchField control, you could replace the magnifier icon with a custom icon using:
  • a 13x13 (26x26 @2x) image.

  • the setSearchButtonCell: API as suggested at

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SearchFields/Articles/CustomizingSearchFields.html#//apple_ref/doc/uid/20002246-BABFIBIA

Now in macOS Big Sur, a 13x13 image is:
  • a little too big

  • drawn over the top of the bezel of the search field.

Trying smaller size does not solve the fact that the image is offseted to the top of the control and is drawn over the bezel.

As there are no offset properties for NSButtonCell, maybe the issue could be fixed with an image whose contents is incorrectly centered. But I'm not in the mood to try this right now.

Questions:
  • Is this a known bug?

  • If this can be solved by using a specific image size, what is this size for a small NSSearchField?

  • If this can be solved by playing with the searchButtonRectForBounds: method, what is the specific rect that should be returned?

FB8913004

Side note:

In macOS BS, the default icon is apparently built from a SF Symbol. But using a NSImage built from a SF Symbol does not display the image but keeps displaying the magnifying glass. Sigh.

NSSearchField dimensions vs Big Sur = regression
 
 
Q