[popover2] feat: ContextMenu2Popover, show/hide imperative APIs #5933
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5527
Checklist
Changes proposed in this pull request:
Add two new APIs to the popover2 package:
<ContextMenu2Popover>
encapsulates some of the opinionated popover implementation of<ContextMenu2>
into a declarative API that can be used by Blueprint users. It's lower-level than<ContextMenu2>
since users have to hook uponContextMenu
handlers and cancel the default context menu themselves withe.preventDefault()
, but this does offer a good declarative alternative to the deprecatedContextMenu.show()
imperative API.showContextMenu()
+hideContextMenu()
imperative APIs which use global state. These are provided as a convenience to make it easy to migrate to Blueprint v5, and they come with warnings about their implementation that consumers must heed. In general they should be fine, though, since we haven't seen many issues with imperative usage ofContextMenu.show()
thus far.Reviewers should focus on:
Docs for the new APIs
Screenshot