ivanhofer/typesafe-i18n-demo-sveltekit

Localeswitcher isn't accessible

Closed this issue · 1 comments

The code example sets a role="button" on the Localeswitcher Li. This is not accessible for two reasons:

  1. the role=button is not allowed on an li, and so will likely be missed by screenreaders
  2. the functionality of a button without using a button element requires a lot of custom JS to ensure it behaves the same way. With a native button element that is built-in.

A second problem is that while the problem of loading a page and setting the lang-attribute on the html tag is beautifully resolved (many thx for that), it is not resolved when switching language with the localeswitcher as that doesn't prompt a reload. For that a small addition to the clickhandler is needed.

Thanks for your detailed description and for creating the PR!