-
Notifications
You must be signed in to change notification settings - Fork 43
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
Feature Request: Make components compatible with MathML #329
Comments
I changed the child type of view! {
<math display="block">
<mfrac>
<Popover>
<PopoverTrigger slot>
<mrow>
<mn>"1"</mn>
<mo>"+"</mo>
<mi>"K"</mi>
</mrow>
</PopoverTrigger>
"Content 1 + k"
</Popover>
</mfrac>
</math>
} |
Awesome :) One thing that confuses me though is: Line 44 in f82d8a3
NodeRef<Div> and attach that to the child of the trigger - that looks like it should break if that child is not a div -node...?
|
It’s so strange, now it can work even if it’s not a div node. I will improve this. |
Huh, interesting - maybe leptos doesn't actually check that the tag matches when setting the NodeRef signal...? (I assume usually it should match by construction, when used as a |
For a project I'm working on, I wanted to have Popups on MathML nodes. Currently, Popover (and possibly/likely other components?) always use
<div>
nodes as wrappers for the trigger, which breaks if the trigger occurs in a MathML node. I therefore had to copy-paste your implementation of Popovers and patch it to selectively use<mrow>
instead.Annoyingly, I then realized that I had to also copy the
Binder
component, since it has a trait guardE::Output: Deref<Target = web_sys::HtmlElement>
(and MathML nodes are notHtmlElement
). It seems that restriction can be weakened toE::Output: Deref<Target = web_sys::Element>
(which MathML nodes implement), since it only seems to be necessary for calls toget_bounding_client_rect
, which only requiresElement
.My solution was for
Popover
to take an optionalDivOrMrow
implemented aswith corresponding enums for NodeRefs, Elements etc.
If you're interested, I could open a pull request
The text was updated successfully, but these errors were encountered: