Hacker News new | ask | show | jobs
by dstaley 2238 days ago
> The underlying problem is Windows suggesting Windows 98 styled buttons

I'm almost positive that Firefox doesn't use OS-native controls; they've specifically styled their controls to look the way they do, so yes, this is a Firefox problem, not a Windows problem.

2 comments

Really? The reason I assumed otherwise is that, the buttons on Mac look like Mac buttons to me. And furthermore, the buttons on my Mavericks Mac (pre Apple's flat redesign) look different than the ones on my High Sierra Mac.
I think it's an imitation. They're not stock UI elements. For example, on my Mojave system, if I just make an HTML button, I can see it doesn't respect the systemwide dark setting, the highlight color looks slightly darker than a normal light-theme button and it doesn't invert the text color when highlighted.
In dark mode, buttons have a darker highlight and don't invert their text color.
Safari on windows were showing osx-styled default buttons, so I think safari also implement their own UI controls, not using system's ui elements.
That’s because Safari was ported to Windows by porting a large chunk of AppKit to Windows - it didn’t make direct use of Win32.
Wow this is interesting! Does that means technically we could have any OSX app compiled for windows while still retaining OSX-like appearance? Did Apple ever released this AppKit windows port for others to use? Does apple still maintaining the port for MacOS as well or did it die along with Safari for windows?
Before NeXT was acquired by Apple, they had OpenSTEP running on top of Windows. Back in the day, you could run a NeXTSTEP app on NeXT hardware, Sun hardware as well as x86: https://en.wikipedia.org/wiki/OpenStep#OPENSTEP_Enterprisee
It was originally ported for and is still used in iTunes.
iTunes uses CoreFoundation but it kinda barely uses AppKit even on macOS.
Please do no try to make osx-like appearance on Windows. It's too alien
Safari buttons on macOS are native unless you style them in a way that causes their font or size to change.
They are not OS-native, but they use OS theming information.
Right. Browsers can't use the OS control implementations, because the demands of DOM/CSS simply can't be handled by those native implementations. But Firefox is trying to emulate the look and feel of the OS controls, using native theme drawing APIs when possible. It is very hard to get 100% right, which is why no browser does.
Huh. I wonder if that applies even to Safari on Mac and iOS, given how integrated Apple likes to be with their UI controls.
Some of them are native, if you don't style them.
That isn't true. Browsers reimplement the native look and feel (in some cases) but they do not use the actual native control implementation.
Safari on macOS uses native controls. The reply button I'm about to click to submit this comment is 100% native, because Hacker News is using nothing fancy beyond <input type="submit" value="reply">. (Interestingly, Safari will outright ignore font sizes it cannot draw a native control for…)
> Browsers can't use the OS control implementations, because the demands of DOM/CSS simply can't be handled by those native implementations. [...] It is very hard to get 100% right, which is why no browser does.

This is not correct. In instances where CSS doesn't affect the styling of the control, the browser can use native controls. As far as I know, every browser _except_ Firefox does this. For example, <select> elements in Chrome and Safari are native elements (albeit Win32 versions in the former on Windows).

Chrome and Safari are absolutely not using the actual native control implementation. E.g. on Windows Chrome is not jamming a combobox HWND into its browser window.
> In instances where CSS doesn't affect the styling of the control, the browser can use native controls. As far as I know, every browser _except_ Firefox does this.

This is not true. It's not just the styling of the control itself that makes it infeasible to just stick an NSButton inside the browser's NSView; it's about the way a control interacts with everything else on the page.

Source: I work on browser graphics.