Accordion: max-width is not working properly in the headings.
Describe the bug
-
max-widthneeds to be added for the case texts get longer in the headings. after addingmax-widthto the button locally, the background color is not going all the way when its hovered over because the hover effect is applied to the button.

-
spanneeds to be added inside the buttons to fix this hover effect bug mentioned above. after addingspaninside the button locally,max-widthis not working asspanhas inline attribute. so I had to adddisplay: inline-blockafter addingdisplay: inline-blockto thespan, the position of the icon in the button moves down.
To summarise:
- the markup in all accordion examples should allow for the text to be constrained by our default "$text-max-width", which will probably involve adding a span inside the button
- unless that span is already styled with a max-width and display:inline-block, then we need these two as utilities
@lyubomir-popov Is it a working group proposal, or simply a bug?
@bartaz depends on how we look at it - one way would be to introduce the span, deprecate the current markup, and leave out the proposed utilities. In this case, it's a bug
but if we are considering utilities, then we surelyt need to run this by @anthonydillon so then it might be a WG proposal
@bartaz feel free to remove the label if you think we can avoid a breaking change and also avoid the utilities. ALthough I do think it's useful to have the $text-max-width exposed as a class
I'll try to look into it and see what would be needed to fix.
ALthough I do think it's useful to have the $text-max-width exposed as a class
@lyubomir-popov I guess it may be useful to have such utility, but accordion shows how tricky it is. It's not as simple as max-width: $text-max-width, because when applied to elements that have background or borders it may make them look in unexpected way.
My idea was to be able to drop a span in between the existing elements, and apply that class to it- exactly to avoid effecting borders and what not.
As Lyubo suggests, it seems we need to add a support for adding additional span (possibly with a accordion-specific class name, or utility) to limit max width of the text inside the accordion button.
This seems to require some changes around styling accordion in terms of spacing and chevron placement.