Duolith docs

Errors E0200 to E0299

E0213 Focus style on something a phone never focuses

Message style never applies on iOS or Android: only a field takes the focus there

Words in italics are filled in when the compiler reports it, such as the element's name or the list of known ones.

Why

On iOS and Android only an input or a textarea takes the focus; the engine sets st-focus, which focus: and :focus-visible become, on fields alone. A focus: utility, or a :focus or :focus-visible selector, on anything else would never apply on a phone, so the native build stops (decision 0049). A selector is on a field when it names input or textarea, or a class the file puts only on fields, or names nothing but the focus (.wrap > :focus), which matches the fields it reaches. :not(:focus) always holds on what never takes the focus, so it is allowed. An element that also has a pressed: utility says what a finger shows, and then focus: stays for the web. Inside @supports selector(:focus-visible) { … }, a rule whose every selector asks for :focus or :focus-visible is for browsers, and the native build leaves it out without a word; any other rule there is checked as if it were outside the block, and what the block would lose is E0210. :focus-within is not checked: a view carries st-focus-within while a field inside it has the focus.

How to fix it

Give the element a pressed: utility too, or put the rule in @supports selector(:focus-visible) { … } to keep it for browsers.

In a terminal

duolith explain E0213

Mentioned in