Skip to content

Widget: Call ._setOptionDisabled() on init if the widget is disabled #1599

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

Closed
wants to merge 11 commits into from

Conversation

scottgonzalez
Copy link
Member

Fixes #9151

The full test suite passes, but I haven't gone through demos to make sure everything actually looks and behaves properly. We should probably also go through the ._create() method for each widget and remove any logic that isn't necessary as a result of this change.

@jzaefferer
Copy link
Member

Looking through uses of disabled options in widgets and testing with {disabled: true} on create:

  • Accordion doesn't respect the disabled option on create. Patched in be67a39
  • Autocomplete works fine
  • Skipping button and datepicker, see rewrite
  • Dialog can't be disabled, need to ensure that on create, patched in e58ed3c
  • Draggable's adding of the disabled class on create is now redundant, patched in 337b307
  • Droppable works fine
  • Menu's handling of the disabled option on create is now redundant, patched in eb5374a
  • Mouse doesn't deal with disabled at all
  • Progressbar, like accordion, doesn't respect the disabled option on create. Patched in 92adcb2
  • Resizable and Selectable work fine
  • Selectmenu's handling of the disabled option on create is now redundant, patched in 0296e9c
  • Sliders's handling of the disabled option on create is now redundant, patched in cab1363
  • Sortable works fine
  • Spinners's handling of the disabled option on create is now redundant, patched in c2a9aa6
  • Tabs is not working correctly, for example it ends up with the ui-tabs-disabled class when only setting specific tabs, like disabled: [1, 2]. Due to the array variant I haven't yet figured out what to do here.
  • Tooltip has special behaviour for disabled, it already disable regular style changes to the element, 68273a4 applies the same for create.

None of the interactions have a visual disabled state, that's on purpose, right?

@scottgonzalez
Copy link
Member Author

None of the interactions have a visual disabled state, that's on purpose, right?

Correct. Interactions don't get visually disabled states because they represent actions, not controls. Applying a disabled state to something like draggable would make the contents of the draggable seem disabled, which isn't the case.

@scottgonzalez
Copy link
Member Author

All of the commits that Jörn referenced are from scottgonzalez#1, if anyone else wants to take a look. I've already reviewed it, and once everything is updated over there, I'll land all of this together.

@scottgonzalez
Copy link
Member Author

@jzaefferer's commits have been merged into this PR.

@jzaefferer
Copy link
Member

I actually failed to verify passing tests (and your repo doesn't have Travis enabled...), so I missed on failing assertion. This fixes it, and seems like the right approach to me: https://gist.github.com/jzaefferer/3c06668c1ed37129edd9

That is, if all individual tabs are disabled, it should have the ui-tabs-disabled class, just like it would have when disabling the whole widget.

jzaefferer added a commit that referenced this pull request Sep 25, 2015
Without this, _on will still respect the disabled option and ends up
preventing closing the dialog.

Ref #9151
Ref gh-1599
jzaefferer added a commit that referenced this pull request Sep 25, 2015
_setOptionDisabled in $.Widget is now handling that.

Ref #9151
Ref gh-1599
jzaefferer added a commit that referenced this pull request Sep 25, 2015
jzaefferer added a commit that referenced this pull request Sep 25, 2015
jzaefferer added a commit that referenced this pull request Sep 25, 2015
jzaefferer added a commit that referenced this pull request Sep 25, 2015
@zhump
Copy link

zhump commented Oct 5, 2015

How to make the jQuery UI Accordion widget multiple?

@scottgonzalez
Copy link
Member Author

@zhump This is not an appropriate place to ask support questions. Please use the forums, Stack Overflow, or IRC.

@zhump
Copy link

zhump commented Oct 5, 2015

ok sorry thanks

@scottgonzalez scottgonzalez deleted the disabled-setter branch July 7, 2016 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants