palantir/blueprint

Close popover when menu item is selected via enter / space key

Open

#4,903 opened on 2021年9月14日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
Domain: accessibilityP2Package: corePackage: popover2Type: enhancementhelp wanted

説明

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>

コントリビューターガイド