Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility: Buttons are coded as div but should be button elements #286

Open
imgiseverything opened this issue Oct 18, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@imgiseverything
Copy link

In order for people within the EU (European Union) (or supplying services to the EU) they will need to comply with the European Accessibility Act and this library has a few issues currently with its compliance:

Button semantics

The component rendered by CustomButtonInnerElements has been coded as a div. I am not sure of the design decision behind this but it would be better if the component was an button with a type="submit" attribute/value.

Source:

const textElement = document.createElement('div');

This would allow keyboard users to easily tab to the button and a screen-reader user would be informed that it is a 'button'

If that is too tricky, an alternative would be to add the role of button to the element e.g.

textElement.role = 'button';
textElement.tabIndex = 0;

This would tell a screen-reader user that the div is being treated as an input, semantically it would become an input and tabindex="0" would allow a user to tab to the element.

Note

It's not 100% clear how customButtonInnerElements.ts, button.ts and submitButton.ts work so setting the 'button' to be a button may need to take place ina. different component to 'CustomButtonInnerElements'

@imgiseverything imgiseverything changed the title Accessibility: CustomButtonInnerElements is a div but should be a button element Accessibility: Buttons are coded as div but should be button elements Oct 18, 2024
@OvidijusParsiunas
Copy link
Owner

Hi.

The buttons were designed over a year ago, hence I can't remember the exact reason they are divs. However if it is better UX I will consider changing their type. The tabIndex = 0 may be problematic as there can be multiple buttons within the same chat, hence giving them all a tabIndex of 0 would not make sense.

I currently have a significant backlog of work that I need to get through prior to this, but I really appreciate the feedback!

@OvidijusParsiunas OvidijusParsiunas self-assigned this Oct 18, 2024
@OvidijusParsiunas OvidijusParsiunas added advice Information how to use/implement the component enhancement New feature or request and removed advice Information how to use/implement the component labels Oct 18, 2024
@imgiseverything
Copy link
Author

@OvidijusParsiunas Thank you for the update.

I believe, adding tabindex="0" to the button (or div) won't affect it's tab order it will merely allow it to be tabbed to so it should be safe. Adding a number greater than 0 is discouraged by 0 itself should be fine to stay on multiple elements.

@imgiseverything
Copy link
Author

@OvidijusParsiunas I read your update that you are busy relocating so I thought maybe I could help with an update here for you?

I have pulled the repository and made the changes locally, I'd be happy to share the changes. What do you think?

@OvidijusParsiunas
Copy link
Owner

Hey @imgiseverything.
Apologies for not getting to the issue earlier, the lack of free time and development of other features has definitely delayed a lot of the progress.

If you have the changes done that's great! You can definitely raise a PR! Just note that I am a very picky reviewer so I may request some changes to maintain our standards and consistency 😉

Thankyou for all your help!

@imgiseverything
Copy link
Author

imgiseverything commented Dec 6, 2024

@OvidijusParsiunas Sure, I'd love to open a PR. I can't push to this repository because I do not have. Could I send you the code some other way?

@OvidijusParsiunas
Copy link
Owner

Hey, I recommend forking this repository and then create a PR that way.

imgiseverything pushed a commit to imgiseverything/deep-chat that referenced this issue Dec 16, 2024
Add the semantic role of 'button' to the .inpout-button whenever it is created so a screen-reader user is told it is a button

Add the tabindex attribute and value of '0' so a keyboard user can tab to the button and

OvidijusParsiunas#286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants