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

Collapse accordion toggle header - increase clickable area #22114

Closed
JacobLett opened this issue Mar 4, 2017 · 6 comments
Closed

Collapse accordion toggle header - increase clickable area #22114

JacobLett opened this issue Mar 4, 2017 · 6 comments
Labels

Comments

@JacobLett
Copy link

JacobLett commented Mar 4, 2017

If you test the accordion snippet and click on the heading to the far right where there is no anchor text the toggle does not open. I think the clickable area should be as big as possible.

Demo of issue and proposed solution: http://codepen.io/JacobLett/pen/GWqjPw

A CSS solution would be to create a new .collapse-accordion class to apply unique styling to the card header and anchor toggle.

Or with javascript make the .card-header clickable and grab the href inside it if one exists.

What do you think?

@mdo
Copy link
Member

mdo commented Mar 19, 2017

Turn the div.card-header into a.card-header and you should get the effect you want. We're also soon to have custom accordion markup when #22138 merges.

@mdo mdo closed this as completed Mar 19, 2017
@amard33p
Copy link

Sorry for reviving an older issue. I am still unable to get this effect in v4.1 after following the examples in https://getbootstrap.com/docs/4.1/components/collapse/#accordion-example. Is there anything I need to add?

@JacobLett
Copy link
Author

@amard33p Scroll down and view my after example that follows Mark's suggestion of using an anchor instead of a div.

https://codepen.io/JacobLett/pen/GWqjPw

@amard33p
Copy link

@JacobLett But that needs custom CSS right? I mean there's some code in the CSS section in the pen.
Sorry I am pretty green on frontend stuff!

@JacobLett
Copy link
Author

@amard33p I forked my example and removed the custom classes. I replaced those with some Bootstrap utility classes. https://codepen.io/JacobLett/pen/VqgwZW

To summarize the changes: Used an anchor tag to add a cursor pointer on hover, but anchors are inline elements so we needed to add a d-block class to make the anchor act like a div and display block.

The red outline shows the clickable area. Let me know if you have more questions.

@amard33p
Copy link

Awesome! Thank you very much!

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

4 participants