Re: [csswg-drafts] [css-position] Ability to set a positioned element's containing block to another element (#5952)

Well, yeah, I ask because being at the top layer doesn't prevent your position being anchored to another element I guess, and the use cases look similar in terms of whether you want stuff like overflow clips to apply or what not.

Anyhow, so... some amount of this can already be done by abspos + hypothetical position (so `inset:auto`, `display:inline` + `margin`) right? That has the issue of needing the "anchored" element being next in the DOM to the anchor, but that seems off hand like a workable solution (if a bit ugly I guess)? E.g. something like:

```html
<!doctype html>
<style>
.editor {
  display: none;
  position: absolute;
  width: min-content;
  border: 1px solid black;
  background: white;
  padding: .3em;
  margin-left: -3em;
}

a:hover + .editor,
.editor:hover {
  display: inline;
}
</style>
Doesn't really matter much where this text wraps, here's some <a href="#" title="Hover to edit URL">cool link.</a> <span class="editor">Url: <input type=text></span>
```

Of course that's not great in lots of ways (it doesn't guarantee it ends up in the viewport, etc etc), but "choose an arbitrary containing block" also has this issue, doesn't it?

-- 
GitHub Notification of comment by emilio
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5952#issuecomment-775608240 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 February 2021 02:25:45 UTC