I have just upgraded to version 3.0 from 2.2 and now the 'esc key' doesn't close a dialog component. I expected the same behaviour no matter the version.
Currently I am using JSF 2.0 with Mojarra 2.0.3 and Tomcat 6.0.28 as servlet container.
Is this a bug or am I doing something wrong?
Thanks very much in advance
Closing dialog with esc key
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
It's gone in 3.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
It can be back but it is not in our immediate roadmap.
Code: Select all
function closeOnEscape() {
var closeable;
var indexHighest = 0;
jQuery(".ui-dialog.ui-widget.ui-widget-content.ui-overlay-visible").each(function() {
var indexCurrent = parseInt($(this).css("zIndex"), 10);
if (indexCurrent > indexHighest) {
indexHighest = indexCurrent;
closeable = this;
}
});
if (closeable != null) {
jQuery(closeable).removeClass('ui-overlay-visible').addClass('ui-overlay-hidden');
jQuery(closeable).css({'visibility':'', 'z-index':'', 'display':''});
var modal = '#' + jQuery(closeable).attr('id') + '_modal';
jQuery(modal).remove();
}
};
<p:hotkey bind="esc" handler="closeOnEscape();" />
Code: Select all
<script type="text/javascript">
jQuery(document).keyup(function(e) {
if (e.keyCode == 27) { //esc
closeOnEscape();
}
});
</script>
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 71 guests