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

SidePane: fire event on show #596

Closed
wkeese opened this issue Feb 19, 2016 · 3 comments
Closed

SidePane: fire event on show #596

wkeese opened this issue Feb 19, 2016 · 3 comments
Milestone

Comments

@wkeese
Copy link
Member

wkeese commented Feb 19, 2016

Although mySidePane.show("content") will fire the delite-after-show event, mySidePane.show() will not.

It's because mySidePane.show() shows the <d-side-pane> itself rather than one of the children of the <d-side-pane>, and thus it doesn't execute the code in DisplayContainer.

Seems like a bug, although technically the description of the delite-after-show event in DisplayContainer.js does specifically use the word "child":

/**
 * Dispatched after child is shown.
 * @example
 * document.addEventListener("delite-after-show", function (evt) {
 *      console.log("just displayed child", evt.child);
 * });
 * @event module:delite/DisplayContainer#delite-after-show
 * @property {Element} child - reference to child element
 */

Still, seems counterintuitive.

@wkeese wkeese changed the title Sidepane: doesn't fire delite-after-show event SidePane: doesn't fire delite-after-show event Feb 19, 2016
@wkeese
Copy link
Member Author

wkeese commented Feb 19, 2016

@cjolif any feelings on what behavior makes sense? And if not delite-after-show, should there be another event for when the show animation completes? A colleague was asking about this so he could focus a field in the SidePane after it opened.

@cjolif
Copy link
Contributor

cjolif commented Feb 19, 2016

The reason for this behavior is the reason for the before/after show events at first. The reason for this series of events was to allow an application framework (dapp for example) to be warned when a container wants to display a child element. This was giving the app framework the opportunity to possibly dynamically instanciate the child (from JSON, from Database, whatever) before it is displayed.

I guess this means that indeed to achieve the use-case you mention another specific event should be added to the side pane.

@wkeese
Copy link
Member Author

wkeese commented Feb 19, 2016

OK. I guess then the naming of the existing events is unfortunate, since delite-after-show sounds like it applies to SidePane (and perhaps other non-DisplayContainer widgets too).

@wkeese wkeese added this to the 0.8.2 milestone Feb 19, 2016
@wkeese wkeese changed the title SidePane: doesn't fire delite-after-show event SidePane: fire events on show / hide Mar 6, 2016
@wkeese wkeese changed the title SidePane: fire events on show / hide SidePane: fire event on show Mar 9, 2016
@wkeese wkeese closed this as completed in e86899c Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants