Skip to content

Use custom element instead of div for in-browser UI #656

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

Open
allansson opened this issue Apr 14, 2025 · 0 comments
Open

Use custom element instead of div for in-browser UI #656

allansson opened this issue Apr 14, 2025 · 0 comments

Comments

@allansson
Copy link
Collaborator

What?

We currently mount the in-browser UI in a div element in the body. This can interfere with the selector generator, causing it to generate a selector that won't work without the UI mounted. For example:

<body>
  <div></div> <!-- Our mount -->
  <div>
    This is some user content.
  </div>
</body>

The selector generator might generate body div:nth-of-type(2), which would select the wrong element when run in a script. To lessen the risk we could append the mount after all the content, but this is at odds with loading the UI as fast as possible.

To get around the nth-of-type problem we should use a custom element e.g. ksix-studio-mount, that decreases the risk of weird interactions with the original DOM.

Another improvement would be to make sure our mount is always at the bottom, but this might require us to monitor DOM changes and move the mount to the bottom. It's possible that React won't like this.

Criteria for considering it done

The mount is using a custom element. Optionally, the mount is continuously moved to be the last element of the body.

@allansson allansson added this to the Browser Recording milestone Apr 14, 2025
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

No branches or pull requests

1 participant