Non-clickable links in a CSS menu

I managed to create a dropdown menu without relying on any JavaScript, but I'm encountering some issues with its functionality in Firefox and IE 10. This is how it appears:

Both Link1 and Link2 are clickable links. In Chrome, clicking on them works smoothly - I get directed to the expected page. However, in Firefox and IE10, the menu simply closes without taking me to the link.

I initially suspected a z-index problem and attempted to resolve it by adding that property, but it didn't seem to have any effect. Interestingly, hovering over the links in Firefox does display the tooltip with the link address.

Any insights into what might be causing this issue? Or perhaps there's a more effective way to achieve this without resorting to JavaScript?

Below is the markup used:

<ul class="header-right">
<li>
    <ul class="user-menu">
        <li class="menu-item" tabindex=0 id="submenu_li">
            <span class="sub-menu-header" title="Menu">Long menu name Menu</span>
            <div class="dropdown"></div>
            <div class="user-sub-menu" id="user-sub-menu">
                <ul class="submenu-list">
                    <li class="submenu-item">
                        <a id="a1" href="/Test">Link1</a>
                    </li>
                    <li class="submenu-item">
                        <a href="/Test2">Link2</a>
                    </li>
                </ul>
            </div>
        </li>
    </ul>
</li>
</ul>

The CSS code is quite extensive:

ul.header-right
{
    position: absolute;
    top: 7px;
    right: 10px;
    list-style-type: none;
    margin: 0;
}

ul.header-right li
{
    display: inline-block;
    padding-left: 2px;
    vertical-align: top;
}

li.menu-item
{
    padding: 2px 2px 2px 10px !important;
}

li.menu-item:hover
{
    background-color: #888888;
    cursor: pointer;
}
...

For further reference, here is the JSFiddle link: JSFiddle

Answer №1

After some troubleshooting, I finally identified the issue (or at least, I believe I did).

When I click on li.menu-item, the #user-sub-menu div appears and everything seems to be working well. However, if I interact with an element inside that div, like clicking on one of the links, the focus is lost from the li.menu-item element causing the div to become invisible.

My assumption is that in Chrome, the link click event is processed before the focus change, leading to immediate results. To address this in Firefox, I included the following CSS to ensure that the #user-sub-menu div remains open even when the li.menu-item loses focus.

#user-sub-menu:active, #user-sub-menu:hover, #user-sub-menu:focus
{ 
    display: block;
}

This adjustment now functions correctly in Firefox. Unfortunately, the issue persists in IE, so I am open to any suggestions or insights from others. In the meantime, I will consider this matter resolved.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Conflicting CSS selection elements in WordPress causing theme theme selection conflicts

Despite trying various edits to my custom CSS, such as including ::selection{color: white; background: #2f3f58;}, copying and pasting code from sites like W3Schools and stack overflow, nothing seemes to work. I am using the Hueman theme from , which has a ...

Radio button selection with table layout

I am designing a quiz template with radio buttons. However, I would like them to be stacked vertically instead of side by side. Why doesn't the <br/> tag work? I'm having trouble understanding it. Can someone assist me? Here is my code: ...

The Angular UI Bootstrap Datepicker fails to appear on top of the Bootstrap Modal

I'm currently working on an Angular app that utilizes UI Bootstrap. Within my app, I have a modal containing a Datepicker at the bottom. However, I've encountered an issue where the Datepicker remains confined within the modal when expanded. I at ...

What is the best way to retrieve the results of an indexedDb request beyond the limitations of its callback function?

I am working on a form that has an input box which I want to auto-complete with values from an IndexedDb objectStore. Currently, it is functioning with two overlapping input boxes, using a simple array. However, I am looking to make it work with the values ...

Having trouble getting CSS to center text properly. It just won't cooperate

After spending 2 days trying to figure this out on my own, I have come to a dead end. It seems that my lack of expertise in CSS is the root cause of the issue. Here is the code snippet I am working with: <table class="demo"> <tr> <th style ...

A guide on applying color from an API response to the border-color property in an Angular application

When I fetch categoryColor from the API Response, I set border-left: 3px solid {{element.categoryColor}} in inline style. Everything is functioning correctly with no development issues; however, in Visual Studio, the file name appears red as shown in the i ...

Can variables be declared for file paths within the HTML code in a TypeScript file?

We utilize the Vaadin designer to create the frontend of our project. Within the .ts files, we have images where we aim to establish variables for the file paths. Currently, the setup looks like this: <img src="../../themes/light/img/example.jpg&q ...

The Google Maps V3 API map is not loading completely

I'm currently in the process of developing an application that will display maps showcasing local dining establishments. Although the map does appear, it's taking an excessively long time to load and never fully loads as expected. My deadline i ...

Tips on attaching a class to elements in a loop when a click event occurs

In my HTML, I am displaying information boxes from an array of objects that are selectable. To achieve this, I bind a class on the click event. However, since I am retrieving the elements through a v-for loop, when I select one box, the class gets bound to ...

"Enhancing Layouts with Bootstrap: Implementing Spacing Between

Is there a way to add additional margin space between columns in my Bootstrap grid layout? I attempted to use a custom CSS class like this .classWithPad { margin: 10px; padding: 10px; } However, this did not resolve my issue. I also experimented w ...

Fine-tuning CSS layout based on perspective alteration

I am working with the following code: function exportTableToExcel(tableID, filename = ''){ var downloadLink; var dataType = 'application/vnd.ms-excel'; var tableSelect = document.getElementById(tableID); var tableHT ...

Utilizing jQuery to clear out data sent through the $.post

I am currently working on developing a multi-part form that involves executing different scripts for each part. Each script checks for essential data and if this data is missing, it should return a string "false". While part 1 fails correctly by calling h ...

Unable to eliminate blue highlighting in Chrome when an element is in focus

After clicking on the search button, there seems to be a persistent blue outline that CSS is not correctly removing despite the settings I've applied. Here is the CSS code I have used: input:focus { -webkit-tap-highlight-color: rgba(0,0,0,0); outl ...

Display a loading message using jQuery Dialog when the page is loading

I have a button that triggers a jQuery Dialog box to open. $( "#dialog" ).dialog({ autoOpen: false, title: 'Contract', height: 450, width:1100, modal:true, resizable: true }); $( ".btnSend" ).click(function() { var id=$(this).a ...

What is the best way to use PHP in order to retrieve the element containing the visit ID from the specific row within an HTML table?

I am working on a project that involves populating an HTML table with data from a database. The table includes an approval button for administrators to approve visits and change their status to APPROVED. I am trying to figure out how to select the element ...

Troubleshooting Google Web Fonts

I seem to be using code similar to what I used before, but it appears that the fonts are not loading. <html> <head> <script src="http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:extralight,light,regular,bold"></s ...

Filter and transfer data from one Angular array to another

As a newcomer to Angular, I am working with an array of events containing multiple arguments. My goal is to filter these events and separate them into two new arrays: upcoming events and past events. Below is a snippet of the TypeScript code I am using: a ...

Enhance the clarity of content within an IFrame by sharpening the focus on

I recently developed an iframe to open a chat site I built using React.js and Tailwind. The iframe is loaded dynamically on the website through javascript. However, I noticed that when I click on the input field inside the iframe, the content appears blurr ...

Multiple occurrences of IP addresses in MySQL

Looking for assistance. I have categories and comments stored with IP addresses. I need to validate all categories for repeated IPs. For each user who uses the same IP twice, add a CSS class (red) to their name. If they use it three times, add another CSS ...

Toggling with Bootstrap 5

I implemented the toggler button using bootstrap 5 in the navbar, but I am facing an issue where the navbar items are not displayed when the browser screen is minimized. What could be causing this problem? And how can I fix it? <!DOCTYPE html> < ...