NSButtons with NSBezelStyleGlass Sometimes Very Long Delay Before Adjusting Appearance After Toggling Dark Mode

I have some buttons. I set the bezelStyle to NSBezelStyleGlass.

I'm sometimes experiencing the following issue:

  1. Put the system in dark mode.
  2. Some glass buttons still draw with the light appearance.

One or more of the following actions usually makes the appearance redraw proper:

-Clicking the button -Deactivating and then reactivating the window. -Close and then reopen the window.

I tried setNeedsDisplay YES etc. but that didn't work The delay is quite noticeable. Everything else is in dark mode except one or two glass buttons.

This seems to workaround the issue:

 BOOL didToggleGlass = NO;
 if (self.bezelStyle == NSBezelStyleGlass)
 {
       // Turn glass off just for a sec.
      self.bezelStyle = NSBezelStyleToolbar;
      didToggleGlass = YES;
  }

  if (didToggleGlass)
  {
         // Put glass back on.
        self.bezelStyle = NSBezelStyleGlass;
   }

Apparently toggling glass cause the effective appearance to change so you can't use the above workaround in a -viewDidChangeEffectiveAppearance b/c you'll create an infinite loop unless you guard against it.

NSButtons with NSBezelStyleGlass Sometimes Very Long Delay Before Adjusting Appearance After Toggling Dark Mode
 
 
Q