Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.
This repository was archived by the owner on May 20, 2026. It is now read-only.

Prepended elements are always placed on top. #58

Description

@thetarnav

Element prepended will be displayed above it's siblings, instead of below, unlike how it would happen if rendered initially alongside it's siblings.

const [condition, setCondition] = s.createSignal(true);

document.addEventListener("keydown", (e) => {
  if (e.key === "Enter") {
    setCondition(!condition());
  }
});

return <>
  <view>
    {condition() && <view color={0xff0000ff} width={100} height={100} x={100} y={10}/>}
    <view color={0x00ff00ff} width={100} height={100} x={150} y={30}/>
  </view>
</>

before:
Image

after:
Image

When prepending elements, the order is correctly maintained in ElementNode.insertChild by using an anchor.
So ElementNode.children is correct, but the order of ElementNode.lng.children is not.

Not sure how to fix that when the lightning renderer doesn't support passing an anchor element.
The only way would be to manually correct parent.lng.children after lightning node is created.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions