PDA

View Full Version : How to stop a combo box from bubbling mouse wheel events?



Mike Stoddart
4 Sep 2013, 8:10 AM
I'm showing an ExtJS window on top of an SVG document. The window contains several buttons, two combo boxes and some text labels. I noticed that when the dialog is visible, mouse scroll wheel events are bubbled up to the SVG DOM. To prevent this I added this code to my window:


// Add a DOM event listener to prevent mouse wheel // events from reaching the SVG document.
listeners: {
render: function (s) {
Ext.get(s.id).dom.addEventListener(
'mousewheel',
function (e) {
e.preventDefault();
e.stopPropagation();
},
true); // Webkit

Ext.get(s.id).dom.addEventListener(
'DOMMouseScroll',
function (e) {
e.preventDefault();
e.stopPropagation();
},
true); // Firefox
}
},


This works except when I open a combo box and scroll the wheel, the events still bubble through to the SVG DOM. Is there a way to prevent a combo box from bubbling mouse wheel events? Thanks

Gary Schlosberg
10 Sep 2013, 3:51 PM
That is strange. So while the combobox is open, you are scrolling *both* the combo and the document behind it? Can you post a test case which demonstrates this issue?

ettavolt
10 Sep 2013, 9:53 PM
Most likely that events bubble from BoundList - it is attached to body and is not a descendant of combo.