title: NSButton background transparent after getting focus
body: <p>I have a problem with some borderless NSButtons in a view, on a transparent popover. When the popover is first opened, the buttons look exactly as they should, but when the popover (or the view inside it) gains focus, the background becomes transparent. 
  The first time it is opened, it looks like this (As it should):<a href="https://i.stack.imgur.com/ZqELP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZqELP.png" alt="enter image description here"></a></p>
  
  <p>But when the popover gains focus, the buttons end up like this:
  <a href="https://i.stack.imgur.com/jYBOl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jYBOl.png" alt="enter image description here"></a>, where the background is transparent and the content beneath the popover is visible.</p>
  
  <p>I already tried the following, which I found scattered around the web:</p>
  
  <pre><code>optionsButton.setButtonType(.MomentaryChangeButton)
  
  optionsButton.cell?.showsFirstResponder = false
  
  let bColor = NSColor(red: 230.0/255.0, green: 230.0/255.0, blue: 230.0/255.0, alpha: 1.0)
  (optionsButton.cell as! NSButtonCell).backgroundColor = bColor
  optionsButton.layer?.backgroundColor = bColor.CGColor
  
  (optionsButton.cell as! NSButtonCell).showsStateBy = .PushInCellMask
  (optionsButton.cell as! NSButtonCell).highlightsBy = .ContentsCellMask
  </code></pre>
  
  <p>optionsButton is, of course, the one on the right. I tried only using some of the code above, but every variation of this doesn't seem to fix it, unfortunately!</p>
  
  <p>Does anyone have any idea on how to avoid this? And does someone know why the trash-button doesn't have the same problem?</p>
  
  <p>Thanks in advance!</p>