I don't know why yet, but Firefox won't focus on radio inputs unless I navigate their with a keyboard. The autofocus attribute and focus() JavaScript function don't work.
-
I don't know why yet, but Firefox won't focus on radio inputs unless I navigate their with a keyboard. The autofocus attribute and focus() JavaScript function don't work.
The code is not the problem, because Vivaldi and Safari do work.
(Tested on macOS, not sure if Firefox for Windows has the same issue).
Annoying.
-
Vesa Piittinenreplied to Marijke Luttekes last edited by
@mahryekuh Can you make a reduced test case in somewhere like Codepen or similar service?
Sometimes making one helps finding the issue by yourself.
Though, Apple + focus is something that has been pain since forever. Like, Apple's opinion is that if you click on something with a mouse focus does not go there. And then people workaround by having `tabindex="0"` on regular link elements
-
Marijke Luttekesreplied to Marijke Luttekes last edited by
Update: It sometimes works! If I refresh a couple of times then it will occasionally do its job. Probably a user error or me being faster than my JS.
The behavior also improved after I fixed a bug where I used the "selected" attribute instead of "checked" (oops).
In CodePen, the behavior is must more consistent and Just Works (tm):
https://codepen.io/MHLut/pen/vYqvEqy
I do dislike the behavior where you only see the `:focus` style on keyboard navigation.
-
Marijke Luttekesreplied to Marijke Luttekes last edited by
Cc. @MerriNet, @melocopon, and @cwilcox808 for the help!
(Please do not tag everyone when responding to this message to avoid spam)
-
Marijke Luttekesreplied to Vesa Piittinen last edited by
@MerriNet I recently had to use the hack where you put `ontouchstart=""` on the body tag so that focus styles showed properly on iOS for a website where that focus style was essential.
I felt dirty and pissed off at Apple
-
Marijke Luttekesreplied to Vesa Piittinen last edited by
@MerriNet I recently had to use the hack where you put `ontouchstart` on the body tag so that focus styles showed on iOS for a website where they are essential.
It felt dirty.
-
Vesa Piittinenreplied to Marijke Luttekes last edited by
@mahryekuh Here's Mayank's post on the focus stuff:
-
Marijke Luttekesreplied to Vesa Piittinen last edited by
@MerriNet Yep, read it when it was published. The accessibility threads were divided on the topic.
-
@MerriNet
If you click on a link, focus *shouldn't* be on the link, it should be on the link's destination.Somewhat ironically, as browsers have added the `:focus-visible` pseudo-class, they've also adopted Safari's approach of using heuristics to differentiate pointer-triggered focus vs. keyboard-triggered, making most use of `:focus-visible` unnecessary.
@mahryekuh -
Marijke Luttekesreplied to Curtis Wilcox last edited by
@cwilcox808 @MerriNet Personally, I'm not a fan of this behavior.
However, I've seen different opinions on the matter following Mayank's article a couple of months ago, some being positive about it.
This leads me to conclude that I do not have enough knowledge to judge this on an expert-level.