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

[SolidusAdmin] Remove inaccessible details/summary element #5835

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Aug 26, 2024

Summary

The variant search on the order#show page utilized a details/summary HTML element in order to get open/close functionality. However, Axe flags this as inaccessible, because the summary element does not have a label. This removes the summary element in favor of a simple div, and changes the controller to rely on a hidden class instead.

This should fix our currently failing builds.

The variant search on the order#show page utilized a `details`/`summary`
HTML element in order to get open/close functionality. However, Axe
flags this as inaccessible, because the `summary` element does not have a
label. This removes the `summary` element in favor of a simple div, and
changes the controller to rely on a `hidden` class instead.
@mamhoff mamhoff requested a review from a team as a code owner August 26, 2024 14:10
@kennyadsl
Copy link
Member

@mamhoff wow, that's new to me. Can you link any resource supporting the fact that the summery element is not accessible? Maybe there's some workaround for that so we can use the native HTML element?

@mamhoff
Copy link
Contributor Author

mamhoff commented Aug 26, 2024

The error we get from Axe references this: https://dequeuniversity.com/rules/axe/4.10/summary-name

It's not that the element is not accessible, it's that the summary (which is hidden, and never clicked in this instance) does not have a label. IMO I don't think this is a case for the summary element semantically, as there's not summary that a user could actually click. In this instance we just used the open/close functionality to get a hidden or not hidden element...

@tvdeyen
Copy link
Member

tvdeyen commented Aug 26, 2024 via email

@benjaminwil
Copy link
Contributor

benjaminwil commented Aug 27, 2024

I agree that <details> doesn’t make semantic sense here, but I think interactable things that users click should be buttons, not <div>s. My understanding is that using <div>s as buttons has its own accessibility problems

@mamhoff
Copy link
Contributor Author

mamhoff commented Aug 27, 2024

But - there is no button. The previous version used the details thing as the container for search results, and just plain hides the summary element, in order to then programmatically show or hide the results container. This is a div :)

@mamhoff
Copy link
Contributor Author

mamhoff commented Aug 27, 2024

This is a screenshot of the old HTML structure:
grafik

This is the new HTML structure:
grafik

You'll see there is no button. The result list for the variant search is hidden by default, but when there's a search term in the search form, it is programmatically unhidden. The whole thing does not have an option for the user to manually hide the search results, instead the user is required to click outside the div to hide the results.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. thank you very much for giving this context. I now wholeheartedly agree with you that this must be a div. one could argue for a ul li structure or dt dl, datalist, whatnot. but in the end it does not matter that much and the immediate issue is resolved. we can rework the variant select anytime, but not in this PR

@tvdeyen
Copy link
Member

tvdeyen commented Aug 27, 2024

For future reference: This is the ideal candidate for a datalist element

@tvdeyen
Copy link
Member

tvdeyen commented Aug 27, 2024

Installer Test is unrelated to this change. Since this blocks all open PRs right now, merging.

@tvdeyen tvdeyen merged commit 900c35a into solidusio:main Aug 27, 2024
11 of 12 checks passed
@tvdeyen tvdeyen added the backport-v4.3 Backport this pull-request to v4.3 label Aug 27, 2024
Copy link

💚 All backports created successfully

Status Branch Result
v4.3

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@MadelineCollier
Copy link
Contributor

Thanks for this @mamhoff !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v4.3 Backport this pull-request to v4.3 changelog:solidus_admin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants