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 chevron padding #653

Open
laurimiller opened this issue Jan 22, 2025 · 4 comments
Open

Accordion chevron padding #653

laurimiller opened this issue Jan 22, 2025 · 4 comments

Comments

@laurimiller
Copy link

I ran into an issue with long accordion headings in the summary tags pushing the chevron onto the next line or out of the button element on certain screen sizes.

I'm wondering if there's an easy way I could add padding to either the summary tag or the ::after element in order to force the text to wrap and have the chevron stay inline with the first row of text?

Image Image

Environment

Mac OS, Firefox 135.0b6

@Yohn
Copy link

Yohn commented Jan 22, 2025

I agree, this would be super helpful.
If anyone has come up with a solution for this that would be awesome to see! If not I'll probably try to tackle it here in the coming days.

@Yohn
Copy link

Yohn commented Jan 23, 2025

The following would need a little more testing, but should work.

details summary {
  position: relative;
}

details summary::after {
  float: none;
  position: absolute;
  top: calc(var(--pico-block-spacing-vertical) * .5);
  right: calc(var(--pico-block-spacing-horizontal) * .5);
}

Yohn added a commit to Yohn/PicoCSS that referenced this issue Jan 24, 2025
Fixes Accordion chevron padding picocss#653

Demo has been updated with new hamburger nav  example.
@Leftium
Copy link

Leftium commented Jan 26, 2025

I think I fixed this in my project by forcing the summary text to one line with ellipses:

Image

Live Demo

Relevant source: https://github.com/Leftium/multi-launch/blob/298e80ae83981d2fb0d76bb7df1f060f348b55c5/src/routes/%2Bpage.svelte#L628-L632

	.editor > summary > div > span:first-child {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

@Yohn
Copy link

Yohn commented Jan 26, 2025

Yeah that's a nice clean way to do it without using relative and absolute positioning!

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

No branches or pull requests

3 participants