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

[popover] the complexity of triggering elements across multiple tree scopes (document or shadow root) #651

Closed
yinonov opened this issue Jan 4, 2023 · 3 comments
Labels
popover The Popover API

Comments

@yinonov
Copy link

yinonov commented Jan 4, 2023

As of now, the idref of 'popovertoggletarget' | 'popoverhidetarget' | 'popovershowtarget' must be in the same tree scope (document or shadow root) of the popover element. Reason is the chance of conflicting identical element IDs in the various trees.

<button popovertoggletarget="my-popover">toggle popover</button>
<custom-element-1>
  #shadow-root
  <div id="my-popover">

<custom-element-2>
  #shadow-root
  <div id="my-popover">

Could triggering elements extend to work across tree scope boundaries?

that's quite a meaningful caveat considering triggering elements in real world use.

@mfreed7
Copy link
Collaborator

mfreed7 commented Jan 19, 2023

It's a good question. Due to the desire for an easy declarative API, IDREFs are indeed used and they are restricted to a single document or shadow root. However, the Javascript (IDL) reflections of these attributes allow arbitrary element references to be used:

<button id=foo>Click me</button>
<div id=host>
  <template shadowroot=open>
    <div popover>My popover</div>
  </template>
</div>

<script>
foo.popoverToggleTargetElement = host.shadowRoot.querySelector('[popover]');
</script>

Does that meet your use case?

@yinonov
Copy link
Author

yinonov commented Jan 22, 2023

absolutely!

@yinonov
Copy link
Author

yinonov commented Jan 30, 2023

@mfreed7

haven't found implementation details on handling the properties for the popover invokers. is there any reference authored by open-ui?

oddbird/popover-polyfill#70 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
popover The Popover API
Projects
None yet
Development

No branches or pull requests

2 participants