Skip to content

Conversation

@treastrain
Copy link
Contributor

@treastrain treastrain commented Nov 12, 2025

Due to commit eb9136d in #142, hoverEffect(_:) can no longer be called on the current InlineElement due to a missing protocol conformance.

This pull request restores support for hoverEffect(_:) on InlineElement.

@treastrain treastrain marked this pull request as draft November 12, 2025 16:18
@treastrain treastrain changed the title Add hoverEffect(_:) support for InlineElement Feature request: Add hoverEffect(_:) support for InlineElement Nov 12, 2025
@treastrain treastrain marked this pull request as ready for review November 12, 2025 16:34
@treastrain
Copy link
Contributor Author

@JPToroDev @twostraws

I'm proposing to restore support for a feature that was broken by the changes in #142 (commit eb9136d). Could you please review this change?

@twostraws
Copy link
Owner

Thank you for this contribution! It looks good to me, although I'm curious about the EmptyHoverEffect rename – could you add a little reasoning around that?

@treastrain
Copy link
Contributor Author

@twostraws Thank you very much for your review and your comment!

Regarding the rename from EmptyHoverEffect to EmptyHTMLHoverEffect, I made this change because the original EmptyHoverEffect stopped conforming to the InlineElement protocol after #142 and now conforms only to HTML. This was one of the main reasons I created this pull request.

I initially considered extending the existing EmptyHoverEffect so that it would conform to both HTML and InlineElement. However, both protocols define an associated type Body and a body property with the same name but incompatible requirements: the HTML version uses the @HTMLBuilder result builder and must return an AnyHTML value, whereas the InlineElement version uses the @InlineElementBuilder result builder and must return some InlineElement.

Because of these conflicting constraints, a single type cannot satisfy both protocols simultaneously. I also considered whether the @_implements attribute could help bridge this gap, but it turned out not to be applicable in this particular case.

For these reasons, I introduced two separate structs—EmptyHTMLHoverEffect and EmptyInlineElementHoverEffect—so that each can conform appropriately to its respective protocol. I hope this clarifies the reasoning behind the rename, and I am happy to revise the naming if you would prefer a different approach.

@twostraws
Copy link
Owner

That's very clear – thank you!

@twostraws twostraws merged commit 10ae60a into twostraws:main Nov 18, 2025
1 check passed
@treastrain treastrain deleted the support-hover-effect-inline-element branch November 18, 2025 10:27
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