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

Accordion header usability #23853

Closed
Herst opened this issue Sep 6, 2017 · 10 comments
Closed

Accordion header usability #23853

Herst opened this issue Sep 6, 2017 · 10 comments
Labels

Comments

@Herst
Copy link
Contributor

Herst commented Sep 6, 2017

Apparently since accordion pane headers look like buttons (now more than ever), it has been shown in our user testing that some users are attempting to click the accordion headers first.

Is there any good reason against making the whole header clickable?

Some examples of other web UI frameworks where the whole accordion header is clickable:

@Ruffio
Copy link

Ruffio commented Sep 6, 2017

That would be so nice.
As I get it, then in v. 4. there is no 'accordion' but a 'collapse', but that doesn't have it either: https://getbootstrap.com/docs/4.0/components/collapse/

@pkozlowski-opensource
Copy link

On the other hand people might want to put other clickable elements in a header (one not causing expand / collapse) - ex. a close button.

Somehow it seems like we should have 2 areas in the accordion / tab header.

@morrissey-ingenious
Copy link
Contributor

morrissey-ingenious commented Sep 6, 2017

You can easily do this with the current implementation see codepen example

https://codepen.io/morrissey-ingenious/pen/qXGXGd

@gijsbotje
Copy link
Contributor

imo it has to be an 'a' element due to accessibility reasons
what you can do is add display: block; to the a element and it will stretch accros the header

examples with "icons"
https://codepen.io/gijsbotje/pen/XaoYGY

@morrissey-ingenious
Copy link
Contributor

@gijsbotje you can easily add aria-roll="button" to my example to resolve any accessibility issues. Your idea of adding display:block is also acceptable that would be accomplished with the class d-block in v4.

Either way I think this issue can be closed.

@Herst
Copy link
Contributor Author

Herst commented Sep 7, 2017

Either way I think this issue can be closed.

It might be worth mentioning in the docs on how to do it.

@twbs twbs deleted a comment from Herst Sep 17, 2017
@XhmikosR
Copy link
Member

PR is welcome.

@Herst
Copy link
Contributor Author

Herst commented Oct 29, 2017

I was about to add a PR but I am still not sure what exactly to mention in the docs. While like @gijsbotje solution with the icons a lot but the code changes needed a are bit too much for the documentation IMHO and I think this would be as a part of bootstrap.

So I guess probably a single line about adding d-block to the link will be enough. BTW, this way it's still not like a button as not the whole space is clickable but in this case it could be combined with @morrissey-ingenious's solution by adding the data-toggle="collapse" and href additionally also to the header <div>, what do you think?

you can easily add aria-roll="button" to my example to resolve any accessibility issues

I don't agree. One should also think about handicapped users not using screen readers or other people first and foremost using the keyboard and in this case proper links are still better because they can be Tabed to.

@Herst
Copy link
Contributor Author

Herst commented Feb 18, 2019

Worth mentioning: Now there is also .stretched-link for making links fill their parents.

@ysds
Copy link
Member

ysds commented Mar 5, 2020

Fixed in #29782

@ysds ysds closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants