Skip to content

Conversation

MGaetan89
Copy link
Contributor

Keep the button hidden if it is hidden when the button is initialized.

@scottgonzalez
Copy link
Member

Button widgets must always have the ui-button class.

… ui-helper-hidden get overwritten on initialization
@MGaetan89
Copy link
Contributor Author

I left the ui-button class, and add ui-button-hidden class if the button is hidden. Is this better ?

@scottgonzalez
Copy link
Member

Yes, thanks. I just did a search and we no longer have any widget-specific -hidden classes, so this should just use .hide() instead of adding a class.

Also, after thinking about this, I have a feeling this will cause more problems than it will solve. If we land this, we will instantly get a lot of complaints about buttons that are initialized inside hidden divs not being visible when the div is displayed.

I'm not comfortable landing a fix for this unless it specifically checks that the original element is what's causing itself to be hidden and not an ancestor. I think this ticket has to stay open until we have a solution for all widgets that generate replacement elements.

@MGaetan89
Copy link
Contributor Author

Okay, I will try to find something to fix that and commit as soon as I find something.

I didn't know that $('selector').is(':hidden') look for all ancestor as weel, that's why I did it that way.

Someone should update the ticket to change the component to ''ui.widget''.

…t itself is hidden (not any ancestor). Fixed #5334 - ui-helper-hidden get overwritten on initialization
@MGaetan89
Copy link
Contributor Author

Here is another try.

If one of the ancestor is hidden, the button is already hidden, nothing is done.
If it's the button element itself which is hidden, the button is hidden when initialized.

In both case, showing the hidden element also display the button. I only tried it with button though. But it should work for any widget.

@scottgonzalez
Copy link
Member

After some more thought, we realized that this would force an inline style of display: none which would be problematic for the specified use case. Since the button is being originally hidden via a class, we can assume that it will be shown by removing the class. However, having the styles inline would prevent that from working.

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.

2 participants