-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add and apply focusStyle
function
#726
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to see someone cleaning up this mess that we had before!
One general question: why 2.5 as width? As someone with 200% scaling on all my devices, I don't mind that as it will result in 5 clean physical pixels. But generally one would try to stay with whole pixels to have a better chance of hitting the pixel grid on most devices, resulting in a sharper looking image. Or not? Are browsers free to round to the pixel grid anyway?
ff19dc0
to
6c8f511
Compare
Regarding the non-integer width: I did some experiments aaaand it seems like browsers round to the nearest pixel to get sharp lines! Here are screenshots from Firefox and Chrome for a 2.5px border: You likely have to download and then open in a viewer/program where you can zoom with nearest neighbor scaling. My desktop scaling was at 200% for all screenshots, I just zoomed the browser to either 100% or 50%. And well: on the 100% scaling, the border is exactly 2px wide, on the 200% scaling it's 5px wide. So... feel very free to put it back to 2.5px :D |
Yes it does look a bit weird, but I don't think it's too much of a problem. Your solution is an interesting one, but with a smaller area changing color and with the bright hover grey, I think the hover effect is too subtle. But we can certainly ask others before deciding on this. |
This pull request has conflicts ☹ |
79070d2
to
ee7bdba
Compare
ee7bdba
to
ac2c92c
Compare
ac2c92c
to
78d8801
Compare
This adds and where possible utilizes a function to apply a default, but somewhat customizable focus outline to elements. This function should be used in place of a manual `:focus` declaration to ensure a uniform focus style that is easily maintainable to Tobira.
78d8801
to
f52b655
Compare
This adds and where possible utilizes a function to apply a default, but somewhat customizable focus outline to elements. This function should be used in place of a manual
:focus
declaration to ensure a uniform focus style that is easily maintainable to Tobira.Important note:
As noted in #724, Safari does not apply a border radius to outlines. This means, that in Safari, the focus outlines will always be rectangular. But I think this is reasonable enough (see my justification for this below).
I replaced the previously used
box-shadow
with an outline for two reasons:box-shadow
in combination withoutline: none
can be problematic with high contrast modes that useforced-colors
, which forcesbox-shadow: none
(for instance Windows high contrast mode). This could be fixed by using sth likeoutline: 1px solid transparent
but:outline
is more flexible thanbox-shadow
, mainly by allowing to set a specific offset. Whilebox-shadow
has theinset
keyword to show it inside the focused element, it does not allow for an outside offset without using multiple shadows.Closes: #654