Vulnerability in EPiServer.Forms
I've got a custom component in the assets pane. It "is" a _ContentContextMixin.
After doing a full reload in the browser I've got two problems:
1. The contextChanged method isn't invoked.
2. The Blocks component gains focus. Given that it's located below my component and my component's height is about the height of the assets pane the assets pane is scrolled down to the Blocks component.
Regarding #1 I'm guessing that that's the expected behavior and I should instead do something with widget command provider or something like that? Either way I'd really like some pointers :)
Regarding #2 I'm guessing my component should also "demand" focus? IF so, how can I ensure that it does it last? Or, can I disable the Blocks component from putting it self in focus?
I should add that the above is in a context where the assets pane is pinned.
For the issue I'm guessing that when your component loads the context is already available so no context change event is triggered. If this is the case you can call the method getCurrentContext. This will return either the context or a deferred which will resolve when the context is available. For example:
console.log("This is the context:", context);
Thanks Ben, works great!
The gadgets should not "steel" focus when the page is reloaded so I have created a bug for that problem.
I do not have a perfect workaround for this problem until the bug has been fixed, but if you set focus yourself when e.g. the deferred for this.getCurrentContext() is resolved it is more likely to happen after the shared blocks gadget get it.
Thanks. Since it's only a problem if the default group with blocks and files isn't collapsed I don't think it's a big deal but nice to know there's a workaround.
A completely separate thing, but can't you guys move the line of code where you set query options for the grid in the fetchData method in ContentQueryGrid to a property and/or separate method? Would be nice to more easily override the default sorting (by name descending) :)