Skip to content

Commit

Permalink
Second level MenuBar does not react fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
akserg committed Jan 12, 2015
1 parent afac7aa commit 9696f21
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions example/hello/src/hello.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:dart_web_toolkit/validation.dart' as validation;
import 'package:dart_web_toolkit/uibinder.dart';

// Validation
void main() {
void main_100() {
dart_html.querySelector("#loading").remove();
//
ui.TextBox textBox = new ui.TextBox();
Expand Down Expand Up @@ -729,8 +729,8 @@ void main_46() {
}

// MenuBar
void main_45() {

void main() { //_45() {
dart_html.querySelector("#loading").remove();
// Create a command that will execute on menu item selection
MenuCommand menuCommand = new MenuCommand();

Expand Down
13 changes: 7 additions & 6 deletions lib/src/event/impl/dom_impl_standard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,18 @@ class DomImplStandard extends DomImpl {
};

dispatchEvent = (dart_html.Event event) {

EventListener listener;
dart_html.Node curElem = event.currentTarget as dart_html.Node;

while (curElem != null && (listener = _listener[curElem]) == null) {
curElem = curElem.parentNode;
}

if (curElem != null && curElem.nodeType != 1) { // dart_html.Node.ELEMENT_NODE
curElem = null;
}

if (listener != null) {
Dom.dispatchEvent(event, curElem, listener);
}
Expand Down Expand Up @@ -259,9 +260,9 @@ class DomImplStandard extends DomImpl {
case "dragenter": elem.onDragEnter.listen(dispatchDragEvent); break;
case "dragover": elem.onDragOver.listen(dispatchDragEvent); break;

case "canplaythrough": dart_html.MediaElement.canPlayThroughEvent.forTarget(elem).listen(dispatchEvent); break;
case "ended": dart_html.MediaElement.endedEvent.forTarget(elem).listen(dispatchEvent); break;
case "progress": dart_html.MediaElement.progressEvent.forTarget(elem).listen(dispatchEvent); break;
case "canplaythrough": dart_html.Element.canPlayThroughEvent.forTarget(elem).listen(dispatchEvent); break;
case "ended": dart_html.Element.endedEvent.forTarget(elem).listen(dispatchEvent); break;
case "progress": dart_html.ApplicationCache.progressEvent.forTarget(elem).listen(dispatchEvent); break;
// First call removeEventListener, so as not to add the same event listener more than once
// elem.on[eventTypeName].remove(dispatchEvent);
// elem.on[eventTypeName].add(dispatchEvent);
Expand Down Expand Up @@ -318,7 +319,7 @@ class DomImplStandard extends DomImpl {
void _applyDispatcher(dart_html.Element elem, dart_html.EventStreamProvider provider, int bits, int chMask, String eventName, int mask, dart_html.EventListener handler, [bool useCapture = false]) {
if ((chMask & 0x00001) != 0) {
if ((bits & 0x00001) != 0) {
_subscription["click"] = provider.forTarget(elem, useCapture:useCapture).listen(dispatchEvent);
_subscription["click"] = provider.forElement(elem, useCapture:useCapture).listen(dispatchEvent);
} else {
_subscription["click"].cancel();
}
Expand Down
6 changes: 6 additions & 0 deletions lib/src/ui/menu_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,12 @@ class MenuBar extends Widget implements HasAnimation, HasCloseHandlers<PopupPane
// Show the popup, ensuring that the menubar's event preview remains on top
// of the popup's.
_popup.setPopupPositionAndShow(new _PopupPanelPositionCallback(this, item));

// Add sub menu into parent menu as AutoHidePartner to fix problem
// with doesn't react second level of menu
if (_parentMenu != null) {
_parentMenu._popup.addAutoHidePartner(_popup.getElement());
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: dart_web_toolkit
version: 0.4.4
version: 0.4.5
author: Sergey Akopkokhyants <akserg@gmail.com>
description: Dart Web Toolkit (DWT) is a development toolkit for building and optimizing complex browser-based applications.
homepage: http://www.dartwebtoolkit.com
environment:
sdk: '>=1.4.0 <2.0.0'
dependencies:
browser: '>=0.10.0+2 < 0.11.0'
browser: '>=0.10.0+2 <0.11.0'
dev_dependencies:
unittest: '>=0.11.0+1 <2.0.0'

0 comments on commit 9696f21

Please sign in to comment.