Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown(onSelect) of elementalui seems broken #98

Open
bijancn opened this issue Mar 5, 2018 · 1 comment
Open

Dropdown(onSelect) of elementalui seems broken #98

bijancn opened this issue Mar 5, 2018 · 1 comment

Comments

@bijancn
Copy link

bijancn commented Mar 5, 2018

The case class

case class Dropdown(alignRight: js.UndefOr[Boolean] = js.undefined,
                    buttonHasDisclosureArrow: js.UndefOr[Boolean] = js.undefined,
                    buttonLabel: js.UndefOr[String] = js.undefined,
                    buttonType: js.UndefOr[ButtonType] = js.undefined,
                    className: js.UndefOr[String] = js.undefined,
                    isOpen: js.UndefOr[Boolean] = js.undefined,
                    children: js.UndefOr[Boolean] = js.undefined,
                    items: js.Array[DropdownMenuItem],
                    onSelect: js.UndefOr[ReactEventFromHtml => Callback] = js.undefined)

offers an onSelect option and I would have expected that it works similar to the onChange of FormInput or the onChange of FormSelect, i.e. I can put a handler in there to change my state of items. However, if I add a handler I see that

    private def handler: ReactEventFromHtml => Callback = event => {
      println(s"event = ${event}"); submit(event)
    }

gives

event = undefined

so I have a hard time using that. I only can see in react dropdown examples that people are using onClick and not onSelect (like here e.g. reactstrap/reactstrap#559). Is this maybe just the wrong attribute?

@bijancn
Copy link
Author

bijancn commented Mar 5, 2018

Correction. onSelect is indeed used by elemental UI. Maybe the types are not correct? I don't understand why I get undefined https://github.com/elementalui/elemental/blob/master/src/components/Dropdown.js#L22 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant