Skip to content
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

[css-anchor-1] Allow anchoring to popover invoker #8671

Closed
jpzwarte opened this issue Apr 3, 2023 · 1 comment
Closed

[css-anchor-1] Allow anchoring to popover invoker #8671

jpzwarte opened this issue Apr 3, 2023 · 1 comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-anchor-position-1

Comments

@jpzwarte
Copy link

jpzwarte commented Apr 3, 2023

Use case: you have a <table> with N rows and you want to use a single popover element for all rows in the table.

<div id="popover" popover>...</div>

<tr>
  <td>
    <button popovertarget="popover" popovertargetaction="show"></button>
  </td>
</tr>
<tr>
  <td>
    <button popovertarget="popover" popovertargetaction="show"></button>
  </td>
</tr>
<!-- etc -->

Afaics you currently have to be explicit in the anchor name. So this scenario is not possible without the use of JS?

@tabatkins
Copy link
Member

This is already possible via the implicit anchor element - in fact, Popover is currently the only thing that can set an implicit anchor.

So in this case the div could write something like #popover:popover-open { position: fixed; top: anchor(bottom); } and it would attach to the whichever button invoked it.

@tabatkins tabatkins added Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-anchor-position-1 labels Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-anchor-position-1
Projects
None yet
Development

No branches or pull requests

2 participants