Provide a way for stylesheets to opt out from default native focus ring
Categories
(Core :: Widget: Cocoa, enhancement, P3)
Tracking
()
People
(Reporter: ntim, Unassigned)
Details
Attachments
(1 file)
14.06 KB,
image/png
|
Details |
See https://twitter.com/rob_dodson/status/1151284106623254528
Testcase: https://jsbin.com/nogorefevu/1/edit?html,output
It appears Webkit+Blink let you use outline: none;
to opt-out, but I don't know if this is standard.
Reporter | ||
Comment 1•5 years ago
|
||
Emilio/Cameron, do you know if there's an existing spec regarding this ?
Comment 2•5 years ago
|
||
data:text/html,<style>::-moz-focus-inner { border: none }</style><button>Foo
?
Comment 3•5 years ago
|
||
Ah, you mean the mac outline.
Reporter | ||
Comment 4•5 years ago
|
||
This doesn't appear to work on macOS, I'm guessing there's some widget code involved here.
Also, is there no actual standard for this ? Chrome/Safari allow you to remove the focus outline using outline: none
. Maybe Firefox should do the same ?
Comment 5•5 years ago
|
||
So ok, this is what I learnt:
- This outline seems hardcoded in the mac code, so not tied to
outline
at all: https://searchfox.org/mozilla-central/rev/22b330ecb3edba1536a54887060cbdd09db21c59/widget/cocoa/nsNativeThemeCocoa.mm#1506 - We indeed not paint any outline for buttons by default for this reason: https://searchfox.org/mozilla-central/rev/22b330ecb3edba1536a54887060cbdd09db21c59/layout/style/res/html.css#718
- We disabled support for
outline-style: auto
in bug 1034018.
I don't think form controls have any proper spec for this kind of stuff, but it makes sense to do this. It seems it should be feasible to just skip that bit if the button doesn't specify an outline. Probably recording a hasOutline
boolean here: https://searchfox.org/mozilla-central/rev/22b330ecb3edba1536a54887060cbdd09db21c59/widget/cocoa/nsNativeThemeCocoa.mm#1291
Like params.hasOutline = aFrame && aFrame->StyleOutline()->ShouldPaintOutline();
, probably.
But this is mac-specific code, not style code. I also don't have a mac, so take anything with a grain of salt :)
Updated•5 years ago
|
Updated•5 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•