palantir/blueprint
View on GitHubClose popover when menu item is selected via enter / space key
Open
#4,903 opened on Sep 14, 2021
Domain: accessibilityP2Package: corePackage: popover2Type: enhancementhelp wanted
Description
Environment
- Package version(s): core 3.49.1 / popover2 0.11.4
- Browser and OS versions:
Feature request
When a menu item inside a popover is clicked, the popover gets closed automatically. For accessibility reasons, menu items also need to be selectable via keyboard (pressing the enter or space key) - in this case the popover should also close automatically.
Examples
Sandbox: https://codesandbox.io/s/blueprint-sandbox-forked-co638?file=/src/index.tsx
In the below example, if the key used on the menu item was enter or space, the popover should close.
<Popover2
content={
<Menu>
<MenuItem
onClick={() => console.info("click")}
onKeyUp={() => console.info("Key up")}
tabIndex={0}
text="Test"
/>
</Menu>
}
>
<Button>Click me</Button>
</Popover2>