Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Error in console while while clicking button #538

@prakashchetan001

Description

@prakashchetan001

Bug Report

Getting Error in console on Button Click
Uncaught TypeError: Cannot read property 'ask' of undefined at Function../node_modules/@stardust-ui/react/dist/commonjs/lib/isFromKeyboard.js.IsFromKeyboard.state (isFromKeyboard.js:14) at Button._this.handleFocus (Button.js:70) at HTMLUnknownElement.callCallback (react-dom.development.js:100) at Object.invokeGuardedCallbackDev (react-dom.development.js:138) at Object.invokeGuardedCallback (react-dom.development.js:187) at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:201) at executeDispatch (react-dom.development.js:466) at executeDispatchesInOrder (react-dom.development.js:488) at executeDispatchesAndRelease (react-dom.development.js:586) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:597)

Steps

  1. Add a Button to trigger the Portal component.
  2. Click the trigger button
  3. Error can be seen in the console
    Below is the sample code
export class AddCollectionControl extends React.Component<
  {},
  IAddCollectionControlState
> {
  private _fields: {
    [key: string]: string;
  } = {};
  constructor(props: any) {
    super(props);
    this.state = {
      shouldOpenModal: false
    };
  }
  public render() {
    return (
      <>
        <Dialog open={this.state.shouldOpenModal}>
           <AddCollectionForm onFieldValueChange={this._onFieldValueChange} />
          </Dialog>
        {this._getAddButton()}
      </>
    );
  }

  private _close = () => {
    this.setState({
      shouldOpenModal: false
    });
  };

  private _onFieldValueChange(name: string, value: string) {
    this._fields[name] = value;
  }

  private _handleClick = () => {
    this.setState({
      shouldOpenModal: !this.state.shouldOpenModal
    });
  };

  private _getAddButton = () => (
    <Button content="Add a new collection" onClick={this._handleClick} />
  );
}

Expected Result

There should be no error in console

Actual Result

Error in the console

Version

0.12.0

Testcase

Metadata

Metadata

Assignees

No one assigned

    Labels

    vstsPaired with ticket in vsts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions