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

feat: Use Popover API to render the command list #273

Open
Bricklou opened this issue Jun 8, 2024 · 2 comments
Open

feat: Use Popover API to render the command list #273

Bricklou opened this issue Jun 8, 2024 · 2 comments

Comments

@Bricklou
Copy link

Bricklou commented Jun 8, 2024

Overview

The Popover API is now widely supported. It would be a good idea to move to it.

Why? Because it would allow use to take advantage of the #top-layer context without having to bother about having a z-index issue on the component. Plus, popover can compute screen border by themselves, which means there would be less JS computation to fix offscreen problems.

Who does this impact? Who is this for?

This would concern everything user, and obviously, might be a breaking change to many of them. But on the other hand, it would use supported browser features instead of custom JS behaviour to compute the rendering.

@hoangnhan2ka3
Copy link

So what if I have a custom context-menu (which allows the user to copy and paste something in the input of cmdk), and it always appears under the command-menu with the new Popover API?

In short, I think the Popover API is only useful if it is used as a tooltip or information popup, not for something that contains input field like cmdk.

@Bricklou
Copy link
Author

Bricklou commented Aug 9, 2024

Supposing your context menu also uses the popover API (and it technically should), there will be no issue with cmdk using it too (or using the dialog API). Popovers can have sub-popovers and also supports forms inside them. So yeah, there wouldn't be any issues with it, since it will show above.

About the usage, the MDN documents say that popovers in modal mode can be used in many ways:

Typical use cases for the popover API include user-interactive elements like action menus, custom "toast" notifications, form element suggestions, content pickers, or teaching UI

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

2 participants