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: mark up .input-button as semantic buttons #323

Merged
merged 3 commits into from
Dec 26, 2024

Conversation

imgiseverything
Copy link
Contributor

As described here: #286 the 'button's coded into deep-chat are not semantic buttons and as such are accessible to keyboard/switch users nor screen-reader users.

role="button"

This PR adds the semantic role attribute with the value of button to the .input-button elements so it announces to screen-readers that it is a button.

Disabled buttons

It also adds other semantics such as aria-disabled="true" instead of just styling the buttons to look disabled so screen-reader users hear when the button is disabled

Note: rather than having aria-disabled="false" when the button is enabled, instead we remove the attribute

Loading/busy buttons

It also adds other semantics such as aria-busy="true" instead of just styling the buttons to look busy so screen-reader users hear when the button is loading.

Note: rather than having aria-busy="false" when the button is not busy, instead we remove the attribute

Keyboard/Switch accessibility

  • Tabindex of 0 is added so non-mouse users can tab to the buttons before interacting with them.
  • :hover styles in CSS are duplicated for :focus-visible so non-mouse users can see when the button is in focus.

Phil Thompson and others added 3 commits November 27, 2024 21:09
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
When the submit button has the class 'disabled-button' apply the attribute `aria-disabled="true"`.

When the submit button has the class 'loading-button' apply the attribute `aria-busy="true"`.

These attributes and their values should inform the screen-reader users that the button is not interactive and loading respectively.

When the button is not disabled, the `aria-disabled` is removed and same for when the button is not loading, it should not have `aria-busy`.
…t-button

A11y/add semantics to input button
@OvidijusParsiunas
Copy link
Owner

OvidijusParsiunas commented Dec 19, 2024

Hey @imgiseverything!
That looks amazing!

The code looks great!
There still seems to be one area where you haven't edited the buttons. That is the modal buttons. Currently, Deep Chat provides two kids of modals; infoModal and the camera modal. Both of these modals add their buttons via the addButtons method. If you don't mind, could you add the necessary attributes to the buttons inside the forEach loop (as I think they would all be the same). I would do it myself, however I am not an expert on this, hence if you could it that would be amazing!

Let me know if you need any help, thankyou!

@OvidijusParsiunas OvidijusParsiunas merged commit 99b83c1 into OvidijusParsiunas:main Dec 26, 2024
1 check passed
@OvidijusParsiunas
Copy link
Owner

OvidijusParsiunas commented Dec 26, 2024

Hi @imgiseverything. Since I am going to release the next version of Deep Chat very shortly, I have merged your changes and make the necessary updates that I mentioned myself.

Thankyou for your work! It is very much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants