civictheme / uikit

UI atomic component-based library with Storybook integration
https://uikit.civictheme.io/
GNU General Public License v2.0
6 stars 5 forks source link

Remove aria-label from buttons that open in a new window. #389

Open alan-cole opened 2 months ago

alan-cole commented 2 months ago

Summary

At: https://github.com/civictheme/uikit/blob/main/components/01-atoms/button/button.twig#L77

an aria label of aria-label="Opens in a new tab" is set, which a screen reader would read out instead of the content within the button.

If removing this, the screen reader will still alert the user that the link opens in a new window, as..

<span class="ct-visually-hidden">(Opens in a new tab/window)</span>

...is included in the button if allow_html is disabled and is_new_window is enabled. This is because text-icon.twig will include it.

Steps to reproduce

Use a screen reader on:

https://uikit.civictheme.io/?path=/story/atoms-form-controls-button--button&knob-Allow%20HTML%20in%20text_General=true&knob-Is%20external_General=true&knob-Kind_General=button&knob-Size_General=regular&knob-Text_General=Button%20text&knob-Theme_General=light&knob-Type_General=primary

With the following settings:

Screenshot 2024-09-20 at 4 46 07 PM

Observed outcome

Screen reader will read out "Opens in a new tab" rather than "Will this text read out?"

Expected outcome

Screen reader should read out "Will this text read out? Opens in a new tab"

sonamchaturvedi28 commented 1 month ago

Test Env: DEV Test Status: PASS Test Result:

Screenshot 2024-10-08 at 2 21 58 PM