Country flag — accessibility
Keyboard
- Not interactive. The flag is never a control.
ARIA
Flagwithouttitleisaria-hidden="true". The number next to it already carries the dialling code.Flagwithtitlebecomesrole="img"witharia-label, for a place where the flag stands alone.PhoneFlagsets the country name astitleon the mark box (a tooltip for sighted users) and keeps the SVG hidden.
Focus
- Takes no focus.
Contrast
- The hairline outline (
#000at 18 % opacity) separates white and pale flags from--bg-canvasin light mode. In dark mode the flag colours carry their own contrast against the dark surface.
Known limits
- Flags are simplified. Fine emblems (Spain, Portugal, Mexico, Saudi Arabia) are reduced to one shape and are recognisable by their colours, not by the emblem.
- 50 countries, matching
DIAL_CODES. A new dialling code needs a new drawing, otherwise the grey tile shows.
Source: docs/avatar/country-flag.a11y.md · GitLab