Skip to content

Conversation

@elmfrain
Copy link
Contributor

@elmfrain elmfrain commented Jul 5, 2025

Summary from issue #459: If a parent element has multiple floating children, then each child cannot use Clay_Hovered() because Clay will report an error, and hovering won't be handled properly.

An element with this ID was already previously declared during this layout.

I've found that Clay_Hovered() uses an anonymous ID for each button, generated from the amount of sibling elements as the offset. However, since floating children are not logically part of their parents, their IDs will not be unique.

My fix makes an element keep track of how many floating children they have to ensure generated anonymous IDs remains unique for each floating child.

clay-bug-fix.mp4

@elmfrain elmfrain changed the title Bug Fix - Multiple Floating Elements Cannot Use Clay_Hovered() [Bug Fix] Multiple Floating Elements Cannot Use Clay_Hovered() Jul 5, 2025
@nicbarker
Copy link
Owner

Hello, thanks so much for opening this one! I'll make some small adjustments to your PR then we'll get it merged 🙂

@elmfrain
Copy link
Contributor Author

elmfrain commented Jul 8, 2025

Sounds good!

@nicbarker
Copy link
Owner

Sorry for the super long delay on this! I've just rearranged the struct fields slightly to reduce the padding in Clay_LayoutElement. Thank you for this contribution!

@nicbarker nicbarker merged commit c6442bd into nicbarker:main Oct 2, 2025
3 checks passed
timwmillard pushed a commit to timwmillard/clay that referenced this pull request Oct 13, 2025
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

Successfully merging this pull request may close these issues.

2 participants