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

Allow Popover to float on top, rather than forced to a side. #303

Closed
msonnemans opened this issue Jan 31, 2024 · 3 comments · May be fixed by #469
Closed

Allow Popover to float on top, rather than forced to a side. #303

msonnemans opened this issue Jan 31, 2024 · 3 comments · May be fixed by #469
Labels
enhancement An improvement to an existing feature/component Svelte 5 Roadmap This issue is planned to be addressed or fixed when the library migrates to Svelte 5.

Comments

@msonnemans
Copy link

msonnemans commented Jan 31, 2024

Describe the feature in detail (code, mocks, or screenshots encouraged)

Inspired by the input fields of a table in Notion, I want to be able to click on an element and then float an Input/Textarea on top of it.

Using the Popover element (through shadcn Svelte) I am able to achieve this by deliberately giving a wrong value to the size property.

<Popover.Content side="wrong" sameWidth={true} overlap={true} class="p-0">
  <Textarea bind:value={$form.name} class="p-0 no-scrollbar"/>
</Popover.Content>

Note: side="wrong" of course makes TS complain. However, it actually achieves the effect that I want in the browser! 🎉

Popover trigger:
image

Popover clicked:
image

I propose this 'bug' is turned into a feature. The side property should accept a value that makes it legal to place popovers on top of the triggered element.

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

No response

@huntabyte
Copy link
Owner

I'll need to dig into the https://floating-ui.com/ docs to see what the best way to handle this is.

@msonnemans
Copy link
Author

msonnemans commented Feb 1, 2024

Without having tested it, I believe that the result of the compute position function can be ignored and the absolute coordinates of the reference element should be used. https://floating-ui.com/docs/computeposition

Edit: by filling in a wrong input for side, I'm hitting this default which confirms my suspicion https://github.com/floating-ui/floating-ui/blob/f74524d9a980f919eeddb88cc221492040180cc6/packages/core/src/computeCoordsFromPlacement.ts#L40

@huntabyte huntabyte added the enhancement An improvement to an existing feature/component label Feb 17, 2024
@huntabyte huntabyte mentioned this issue Sep 25, 2024
4 tasks
@huntabyte huntabyte added the Svelte 5 Roadmap This issue is planned to be addressed or fixed when the library migrates to Svelte 5. label Oct 3, 2024
@huntabyte
Copy link
Owner

Closing as fixed in bits-ui@next via Popover.ContentStatic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to an existing feature/component Svelte 5 Roadmap This issue is planned to be addressed or fixed when the library migrates to Svelte 5.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants