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

Ensure active button styles are not applied to disabled buttons #23544

Merged
merged 5 commits into from
Oct 9, 2017
Merged

Ensure active button styles are not applied to disabled buttons #23544

merged 5 commits into from
Oct 9, 2017

Conversation

prateekgoel
Copy link
Contributor

I have added the styles same as .disabled to .disabled:active.
This should fix #23353.

Let me know if any other changes are required.

@prateekgoel prateekgoel changed the title Add styles same as disabled to prevent active state of disabled Add styles same as disabled to active state of disabled Aug 18, 2017
@prateekgoel prateekgoel changed the title Add styles same as disabled to active state of disabled Add styles same as disabled to active state of disabled buttons Aug 18, 2017
@patrickhlauke
Copy link
Member

Haven't had a chance to test it, but one question that pops into my head: are there situations where a .disabled element receives the programmatically set .active class? I think our scripts should check for that/prevent that.

If .active isn't set to things that are .disabled, I'd slim down the rules to only cover :active pseudo

@prateekgoel
Copy link
Contributor Author

I am not sure if any disabled element receives .active class.
If someone can confirm, it would be great. We can eliminate some rules then.
CC @mdo

&:disabled,
&.disabled:active,
&:disabled:active,
&.disabled.active,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Why is this duplicated?

&.disabled:active,
&:disabled:active

Copy link
Contributor Author

@prateekgoel prateekgoel Sep 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @andresgalante,
These two lines are not exactly same. First one applies to active state of button having .disabled class and the second one applies to active state of disabled button with disabled attribute.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right! sorry I miss read the : and the .
Thanks for the clarification

@patrickhlauke
Copy link
Member

an alternative, more terse way (instead of redefining :active/.active for when the button is disabled) would be to make the current active selectors more specific, e.g. &:not([disabled]):not(.disabled):active, &:not([disabled]):not(.disabled).active - or would that be too cryptic?

@prateekgoel
Copy link
Contributor Author

Sorry @patrickhlauke , didn't get you.
Using :not will target the buttons that are not disabled. We need to target the disabled buttons, right?

@patrickhlauke
Copy link
Member

@prateekgoel what i mean is: instead of redefining new styles for disabled+active scenario, you could likely save yourself all the redefinition by instead making the current active styles for buttons only target buttons that aren't disabled.

@patrickhlauke
Copy link
Member

i.e. not adding new style blocks, and instead changing

&:active,
&.active

to

&:not([disabled]):not(.disabled):active,
&:not([disabled]):not(.disabled).active

@prateekgoel
Copy link
Contributor Author

prateekgoel commented Sep 27, 2017

Yes, got your point. Seems a nice idea.
I will do this change and update the PR.

@prateekgoel
Copy link
Contributor Author

Thanks for the suggestion. 😃

@prateekgoel
Copy link
Contributor Author

@patrickhlauke Did the changes.

@patrickhlauke patrickhlauke merged commit de3973b into twbs:v4-dev Oct 9, 2017
@patrickhlauke patrickhlauke changed the title Add styles same as disabled to active state of disabled buttons Ensure active button styles are not applied to disabled buttons Oct 9, 2017
@patrickhlauke
Copy link
Member

Sorry for the delay...but finally able to build locally and test, and it works well (even in IE11) :)

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

Successfully merging this pull request may close these issues.

4 participants