Closed Bug 294676 Opened 19 years ago Closed 19 years ago

Alerts firing for valid ancestors

Categories

(Core Graveyard :: XForms, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aaronr, Assigned: smaug)

References

Details

Attachments

(1 file, 3 obsolete files)

An alert should only show itself when it's parent element is invalid and then
only once.  We currently have a problem where we are attaching a listener to the
parent element looking for xforms-invalid events, but we don't test to make sure
that the xforms-invalid is only targeted at our parent element.  So right now if
we put an alert on a valid group, for example, and it has an invalid child, the
group's alert will fire.

Testcase and patch coming.
Attached file testcase (obsolete) —
testcase.  When loaded, no popups should be seen
Status: NEW → ASSIGNED
Attached file also shows help triggered incorrectly (obsolete) —
help should also not be triggered for group.  The 'hint' is tougher to
determine by sight since the input is contained in a group so maybe the hint
should show even if you move the mouse over the input.
Attachment #183917 - Attachment is obsolete: true
Attached patch v1 (obsolete) — Splinter Review
very quickly made patch. Hopefully I catched all the cases.
Attachment #183940 - Flags: review?(aaronr)
Comment on attachment 183933 [details]
also shows help triggered incorrectly

The help should be seen.
invalid
Attachment #183933 - Attachment is obsolete: true
Blocks: 294697
Attached patch v2Splinter Review
Added few comments and stopPropagation also for xforms-hint.
Assignee: aaronr → smaug
Attachment #183940 - Attachment is obsolete: true
Attachment #183945 - Flags: review?(aaronr)
Attachment #183940 - Flags: review?(aaronr)
Comment on attachment 183945 [details] [diff] [review]
v2

dandy!
Attachment #183945 - Flags: review?(aaronr) → review+
Attachment #183945 - Flags: review?(doronr)
Comment on attachment 183945 [details] [diff] [review]
v2

>? dependentLibs.h
>Index: nsXFormsMessageElement.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/xforms/nsXFormsMessageElement.cpp,v
>retrieving revision 1.5
>diff -u -8 -p -r1.5 nsXFormsMessageElement.cpp
>--- nsXFormsMessageElement.cpp	17 May 2005 20:04:08 -0000	1.5
>+++ nsXFormsMessageElement.cpp	18 May 2005 21:03:00 -0000
>@@ -379,27 +379,50 @@ nsXFormsMessageElement::ParentChanged(ns
> 
> NS_IMETHODIMP
> nsXFormsMessageElement::HandleAction(nsIDOMEvent* aEvent, 
>                                      nsIXFormsActionElement *aParentAction)
> {
>   if (!mElement)
>     return NS_OK;
> 
>+  if (mType != eType_Normal) {
>+    nsCOMPtr<nsIDOMEventTarget> target;
>+
>+    if (mType == eType_Alert) {
>+      // Alert should fire only if target is the parent element.
>+      aEvent->GetTarget(getter_AddRefs(target));
>+    } else {
>+      // If <help> or <hint> is inside <action>, we don't want to fire them, 
>+      // unless xforms-help/xforms-hint is dispatched to the <action>.
>+      aEvent->GetCurrentTarget(getter_AddRefs(target));
>+    }
>+    nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(target));
>+    nsCOMPtr<nsIDOMNode> parent;
>+    mElement->GetParentNode(getter_AddRefs(parent));
>+    if (!parent || targetNode != parent)
>+      return NS_OK;
>+  }

Won't hint/help stop the event from propogating, so that when ever you see one,
you should show it?
Attachment #183945 - Flags: review?(doronr) → review+
> 
> Won't hint/help stop the event from propogating, so that when ever you see one,
> you should show it?
> 
No, if <hint>/<help> is inside <action>
checked in
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: