How to use the @uifabric/utilities.KeyCodes.space function in @uifabric/utilities

To help you get started, we’ve selected a few @uifabric/utilities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / packages / react-cards / src / components / Card / Card.view.tsx View on Github external
const _onKeyDown = (ev?: React.KeyboardEvent): void => {
    if (onKeyDown) {
      onKeyDown(ev);
    } else if (onClick && ev && (ev.which === KeyCodes.enter || ev.which === KeyCodes.space)) {
      // If onKeyDown is undefined and onClick has been passed, then replicate a Button's behavior by triggering the onClick function on
      // pressing down the 'Enter' and 'Space' keys.
      onClick();
      ev.preventDefault();
    }
  };
github microsoft / fuse-webui / fuse-ui-fabric / topNav / topNav.tsx View on Github external
return x => {
      const keyCode = x.which;
      if (keyCode === KeyCodes.space || keyCode === KeyCodes.enter) {
        x.currentTarget.click();
        x.preventDefault();
        x.stopPropagation();
      }
    };
  }
github OfficeDev / office-ui-fabric-react / packages / date-time / src / components / Calendar / Calendar.base.tsx View on Github external
return (ev: React.KeyboardEvent) => {
      switch (ev.which) {
        case KeyCodes.enter:
        case KeyCodes.space:
          callback();
          break;
      }
    };
  };
github microsoft / fluent-ui-react / src / components / FocusZone / FocusZone.tsx View on Github external
!this.focusElement(getNextElement(
            ev.target as HTMLElement,
            (ev.target as HTMLElement).firstChild as HTMLElement,
            true,
          ) as HTMLElement)
        ) {
          return
        }
      } else {
        return
      }
    } else if (ev.altKey) {
      return
    } else {
      switch (ev.which) {
        case KeyCodes.space:
          if (this.tryInvokeClickForFocusable(ev.target as HTMLElement)) {
            break
          }
          return

        case KeyCodes.left:
          if (direction !== FocusZoneDirection.vertical) {
            this.preventDefaultWhenHandled(ev)
            if (this.moveFocusLeft()) {
              break
            }
          }
          return

        case KeyCodes.right:
          if (direction !== FocusZoneDirection.vertical) {