-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Update pane initialization and display logic #607
Conversation
…ow' parameter, and publish a subscribable event when toggling a pane.
@amcgee Please merge the new changes from the cmv-app develop branch and then I will merge in your enhancement. Thanks! |
Updated, thanks! |
This seems to be causing a problem. When a pane is toggled via a collapse button it no longer works. It looks like line 182 will send the key, and the domEvent as a second argument.
The new logic doesn't check for this, and throws an error. See my comment in the Files Changed tab |
// Toggle | ||
newDisp = (oldDisp === 'none') ? 'block' : 'none'; | ||
} else { | ||
this.handleError({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to replace this error message with this:
newDisp =(domStyle.get(domNode, 'display') === 'none') ? 'block' : 'none';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks @roemhildtg! While accepting any type of 'show' argument and toggling if it isn't a display CSS string or boolean would work, another fix is to update the Toggle handler to call togglePane with three explicit arguments so we get togglePane(key, null, false, ). That keeps the togglePane API as strict as possible. I will open a separate pull request for discussion about that approach. EDIT: I'll comment on the PR you opened.
Allow initially-hidden non-collapsible panes, sanitize togglePane 'show' parameter, and publish a subscribable event when toggling a pane. This allows for better declarative configuration without needing to utilize CSS properties or javascript callbacks.
Note : setting "open: false" still causes the sidebar to flash before disappearing. This is because the initial CSS is still set to display 'block'. To fix this, the pane initialization function would need to modify the CSS of the sidebar before it is rendered.