catamphetamine / react-phone-number-input

React component for international phone number input
http://catamphetamine.gitlab.io/react-phone-number-input/
MIT License
914 stars 193 forks source link

Accessibility: role="presentation" in <img> #368

Closed ajotka closed 3 years ago

ajotka commented 3 years ago

Hi!

I can't pass WCAG AA 2.1 test because of role="presentation" in <img class="PhoneInputCountryIconImg". image

Validator: AXE v.4.6.1 (axe-core 4.0.2)

Issue info: https://dequeuniversity.com/rules/axe/4.0/aria-allowed-role?application=AxeChrome

From W3C Doc about role="presentation":

Be aware that the markup <img role="presentation" alt="non-empty alt text"…> is in fact contradictory: Declaring a role of presentation says that the image is for layout, is decorative and meaningless, whereas the non-empty alt text implies that the image is meaningful. It is recommended that authors instead use empty alt text (alt="") where they use role="presentation".

catamphetamine commented 3 years ago

See the related commit: https://gitlab.com/catamphetamine/react-phone-number-input/-/commit/8ffdb0da6a04fe085133e5847a98a4f3b1b8cf24

A new version will be published in the near future.

catamphetamine commented 3 years ago

published react-phone-number-input@3.1.1