473,692 Members | 2,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Context menu item link still selected after click

2 New Member

Here's my problem - I've been trying to figure this out for a while and ran out of ideas...
  • <div> id1 contains <div> id2 (a geographical map)
  • <div> id2 contains a context menu made out of an <ul> list. the context menu operations work fine, links are hovered, etc
  • When I click one context menu items named "view large", <div> id2 is moved to another parent element, <div> id3 and resized. The move is performed using appendChild()
It all works, but when I right click on the new, larger map, the "view large" context menu item is functional, but still selected. It seems to me that the only cause for this behavior is the fact that the id2 object has changed parents, because the other context menu operations end with deselecting the menu.

The context menu styles are controlled with CSS. The menu class is "pmenu". The unselected item is "ul.pmenu li a" and the selected one is " ul.pmenu li a:hover". It looks like the link never becomes "unhovered" when the parent is removed and placed somewhere else.

You can see all this at http://travelrats.blogspot.com. Right click on the map and select "view large map". Then on the large map, right click again - the name of the menu item changes to "back to blog", but it is still selected.

Any ideas will be highly appreciated
Feb 3 '07 #1
2 2452
2 New Member
No reply to my post but I think I have an idea; even if I still lack a deep understanding of the inner works of the html DOM, at least I was able to fix the problem.

In case anybody is interested: the menu item link stays selected because the menu <ul> node itself is moved together with the <div> map container, to a different parent node in the document, before the "onclick" operation is completed. Therefore, IE is unable to notify the link that the operation has completed and it is no longer in the ":hover" state. I'm not sure how that mechanism really works, but it seems common sense. I have not been able to call anchor.blur() explicitly and make it lose focus.

The fix is simple: do not move the context menu <ul> element together with the <div> element containing the map. Leave the menu anywhere on the page in a container that is not being moved or made invisible - this way it can be used by the large map and the small map containers, and since it is not moved with the map, the operation can complete and the link is de-selected.

Feb 4 '07 #2
16,027 Recognized Expert Moderator MVP
Hi Fritz

Thanks for that info.
Feb 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped up, the window does not closes until I click on the window. Below is the code. Hopefully, you can help me out.
by: Roman Muntyanu | last post by:
Hi all, I wrote add-in that can do different job for files with different extension. When I do right click on the file I see all my custom menuItems in context menu of solution explorer for all kind of files . But I want to see only menuItem that specific for the file selected. Ok, after I click on one of the menu Item action performs and when I do right click next time I see only menu Item specific for file selected e.g. it works as I...
by: yxq | last post by:
Hi I am build vb6 Context menu extension, but how to determine which popup menu item(popupItem1 and popupItem2) was clicked? Thanks The code ' ' IContextMenu::QueryContextMenu '
by: Sameh Ahmed | last post by:
Hello there i have a context menu linmked to a listview control. I want the context mnu to appear ONLY when i right click on an item and not any place in listview. any ideas? Thanks in advance. PS: i want the same with treeviews Regards Sameh
by: gilad | last post by:
Hi, I seem to be having a problem getting a context menu to work in Explorer. The menu item installs fine, but when I click it a message box should pop up indicating the command was received and handled. Unfortunately, nothing occurs. I suspect that I am doing something wrong with the command ID for the menu item, but I can't figure out what. After registering my DLL, the menu item "my context menu" appears if I right-click any file. If...
by: Karl | last post by:
Hi all, I want to write an application that is launched from the context menu in Windows Explorer/Computer. That is to say, when I am browsing around my hard drive and get to any location I choose, I want to be able to select several files, right click my mouse and launch an application which will act on the selected files. However, I don't even know where to start and have a number of questions!
by: PW | last post by:
Hi, What is one and does Access 2003 have one? Or how would I create one? I would like the user to be able to right-click on a form or a control on a form and have a menu that offers to go to a reservation, client, activity, etc.... maybe even print something. Thanks, -paulw
by: EvilProject | last post by:
Hi im writing a class of a context menu where each menu item is linked to a Tree Node. I have a click event (that belongs to the context menu class ,not the menu item class) that it's event arguments contains a reference to the tree node linked to the menu item that was clicked. in the case that no menu item was selected, i want to fire this event with a null refrenced tree node.i could have done so if the collapse event of the context menu...
by: dharmbhav | last post by:
Hello all, I am trying to develop a roll-over menu effect on a page. It works fine with all other browsers except IE6. Can some one please help me? HTML: <div class="menu-item-wrap"> <a href="#" class="menu-item-text"> Menu1 </a>
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.