-
-
Notifications
You must be signed in to change notification settings - Fork 975
improve <Portal/>
container, add 2 new properties
#2502
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
base: main
Are you sure you want to change the base?
Conversation
- `asElement` allows to change Portal container element type - `class` allows to set class for Portal container
|
I wonder, if defaulting the container with this inline style will solve it is possible to hack it as shown here if Portal has intentions to support fragments in the future ( no wrapper ) it is nice however to have control of the container element however and its styling. |
I'm not sure I would want a hacky solution. It is not friendly with accessibility since Fragment support is nice though. |
one more thing |
Yeah, when I made this, I didn't think that far. But you are right. It should support all html attributes. We can do that with @mizulu what's your thought? |
first of all before you make any more changes, I would wait for @ryansolid feedback. now back to the discussion <Portal
element={()=>{<div/>}}
fallback={()=>{}}
style={} class={} attr:id={"portal_1"} prop:tabIndex={0}>
</Portal> but if we do it this way, I don't know if Portal will be able to narrow its type to and if we already pass an element, perhaps the better api for this will simply be <Portal
element={()=><div class={myclass} attr:id="portal_1" />}
fallback={()=>{}}>
</Portal> some more considerations:
|
I don't know what is "three mandatory fields" since I only saw 2 headings. But I filled all of them.
Summary
Bascially, I don't like a bare
<div/>
wrap children component so I would like to suggest make Portalcontainer
be more customisable with tagName and class. We can find a way to support dataset later if it requires.How did you test this change?
I've update test file and run test script from
package.json
s:/
→pnpm test
cd ./packages/solid
→pnpm test
Both of them return all pass results so I assume there is nothing would break the framework. As for testing on real field, I'm not sure how to do that yet.