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 disabled style inconsistent #1542

Closed
ajhenry opened this issue Jun 19, 2019 · 1 comment · Fixed by #1571 · May be fixed by largerock/largerock.com#5
Closed

Dropdown disabled style inconsistent #1542

ajhenry opened this issue Jun 19, 2019 · 1 comment · Fixed by #1571 · May be fixed by largerock/largerock.com#5

Comments

@ajhenry
Copy link

ajhenry commented Jun 19, 2019

  • components: Dropdown
  • reactstrap version 8.0.0
  • import method umd/csj/es
  • react version 16.8.6
  • bootstrap version 4.3.1

What is happening?

On a Dropdown component, there is a prop to disable it. But when the disabled prop is applied, there is no indication that the dropdown is disabled.

The Dropdown can still be opened even when it is disabled and this does not match the rest of the disabled behaviors on components like Button, Input, etc..

From the docs

Dropdown.propTypes = {
  disabled: PropTypes.bool,
  ...other props
};

What should be happening?

The Dropdown should have the disabled state applied and be inaccessible.

Steps to reproduce issue

Just apply the disabled prop to any Dropdown component

Error message in console

N/A

Code

Check out the codesandbox here

@ajhenry ajhenry changed the title Dropdown disabled prop ignored Dropdown disabled style inconsistent Jun 19, 2019
@TheSharpieOne
Copy link
Member

The issue is that the dropdown context toggle is referencing the user defined toggle directly and not the Dropdown toggle which does the disabled check.

We also probably need to be exposing disabled on the context so that the button can pick it up to be visually disabled.

Workaround: add disabled to the DropdownToggle.

bpas247 added a commit to bpas247/reactstrap that referenced this issue Jul 11, 2019
This fix addresses the issue where Dropdown will be passed a
`disabled` prop, yet it is still clickable. This is due to context
being passed the user-defined `toggle` prop directly, rather than
our defined `this.toggle` function that includes a check for
`disabled`.

Fixes reactstrap#1542
TheSharpieOne pushed a commit that referenced this issue Jul 12, 2019
* fix: Dropdown disabled toggle issue

This fix addresses the issue where Dropdown will be passed a
`disabled` prop, yet it is still clickable. This is due to context
being passed the user-defined `toggle` prop directly, rather than
our defined `this.toggle` function that includes a check for
`disabled`.

Fixes #1542

* fix: incorrect test assertion

In the previous implementation, Dropdown wasn't properly firing
the toggle function within Dropdown, so the assertion was written
down wrong to compensate for that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment