-
Notifications
You must be signed in to change notification settings - Fork 70
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
tagAppendAttributes()'s .cssSelector doesn't match top-level tag #334
Comments
I'd be ok with having all tag wrapper methods changing the starting location to the top elements instead of the first layer of children. But I do not want a single tag method behaving differently than the other tag methods. |
It's be a breaking change. But at least it's be a consistent change throughout the methods |
After chatting with @schloerke, we're thinking it'd be nice to have this functionality more of a 1st class feature of
|
After another discussion, No alterations will be made to tagAppendAttributes(). Users can use |
I thought we'd still make the (technically breaking) change to |
I think we should revisit the decision not to allow A part of the appeal of In this perspective, it's relatively common to create a component and want to modify some part of the tree nearly in place. It's also reasonably common that you would need to use the parent element as an anchor to get direct children of the parent element. In this case, knowing whether or not the root element matches the selector isn't enough, you'd have to include the root element in the selector. For example, in the following example there's no way to target the global sidebar container (direct child of navs_tab_card(
sidebar = sidebar("global sidebar"),
nav("One", layout_sidebar(sidebar("local sidebar"), "Page content"))
) |>
tagAppendAttributes(
class = "my-class",
.cssSelector = ".card > .bslib-sidebar-layout"
) The current work-around is to apply div(
navs_tab_card(
sidebar = sidebar("global sidebar"),
nav("One", layout_sidebar(sidebar("local sidebar"), "Page content"))
)
) |>
tagAppendAttributes(
class = "my-class",
.cssSelector = ".card > .bslib-sidebar-layout"
) ...but this could end up moving the |
One more thought: I think that following In the JavaScript case, you can always In htmltools, though, we're operating on a trimmed branch of html-like structure that will end up being part of the DOM, but isn't quite yet. For me, this fact is important and makes starting from the root node more desirable. |
If we adjust This would be a breaking change. If Suggested behavior:
If this was implemented, all of the tagAppend-like methods would automatically adopt this behavior of being able to execute on top level elements. |
For the second item, could
|
I don't currently have an opinion about |
Talking with @jcheng5 , he might be up for adopting the proposed behavior within the tag methods (where the Will come back to this Issue at a later date |
I'd expect this to add the (
bar = "BAR"
) attribute, but it currently doesn't:The reason why this doesn't work is that
tagQuery()
is only able to$find()
children of the input tagMaybe it would make sense for
tagAppendAttributes()
to wrap the input up into a "dummy" tag (cc @schloerke)?The text was updated successfully, but these errors were encountered: