After a deep investigation, the results are in.
This is definitely a bug.
The code in question
var index = $("widget-chooser").getStyle("zIndex");
Was added in 1.4, to fix a bug. Apparently, when you had a date element in a widget configuration screen, the calendar was appearing below the element with the widget configuration and you couldn't select a date.
The code is there in order to set a z-index
to the calendar element bigger than the z-index
of the widget element.
I tried to avoid class rewrites, so here is my stupid fix to the issue:
I created a custom layout handle in one of the admin layout files.
<fix_calendar_js_issue>
<reference name="content">
<block type="core/text" name="dummy-widget-chooser" as="dummy-widget-chooser">
<action method="setText">
<text><![CDATA[<script type="text/javascript">
Event.observe(window, 'load', function() {
if (!$('widget-chooser')) {
$$('body')[0].insert('<div id="widget-chooser"></div>');
}
});
</script>]]></text>
</action>
</block>
</reference>
</fix_calendar_js_issue>
This just ads a div with id widget-chooser
if one does not exist in the DOM.
Now all I have to do is to include this handle in the pages that show this error.
For example the shopping cart price rules.
<adminhtml_promo_quote_index>
<update handle="fix_calendar_js_issue" />
</adminhtml_promo_quote_index>
All of these can be done from a single custom layout file.
js/mage/adminhtml/wysiwyg/widget.js
loaded?