Drop-down menu vanishes when hovered over (Mozilla Firefox)

I am facing an issue where a button with a dropdown menu that appears on hover works perfectly fine in Chrome, but in Firefox the dropdown disappears when I try to select an item from it. Here is my CSS and JS fiddle for reference.

button {
    position:relative;
}
.flags_home_middle {
    top: 68%;
    right: 23%;
    left: inherit;
}
.flags_item_features {
    -webkit-transition-duration: .8s;
    transition-duration: .8s;
    opacity: 0;
    visibility: hidden;
    padding: 3px !important;
    width: 211px;
    position: absolute;
    top: 51%;
    left: 23%;
}
.flags_item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
.btn_buy_features:hover .flags_item_features {
    opacity: 1;
    visibility: visible;
    background: #EBEBEB;
    box-shadow: 0 3px 9px -2px rgba(0, 0, 0, .5);
}

Check out this JS Fiddle for more details.

Answer №1

It appears that Firefox is not properly handling child elements of interactive elements with new stacking contexts when using hover. To work around this issue, I have positioned your entire menu next to the button and set your container as a relative parent. Additionally, I have expanded the safe zone slightly using a pseudo-element.

Link to the updated code

button {
  position:relative;
}

.buy-button-wrapper
{
  position: relative;  
}

.flags_home_middle {
    top: 68%;
    right: 23%;
    left: inherit;
}
.flags_item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
.flags_home_middle {
    top: 68%;
    right: 23%;
    left: inherit;
}
.flags_item_features {
    -webkit-transition-duration: .8s;
    transition-duration: .8s;
    opacity: 0;
    visibility: hidden;
    padding: 3px !important;
    width: 211px;
    position: absolute;
    top: 10px;
    left: 10px;
}
.flags_item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
.btn_buy_features:hover + .flags_item_features,
.flags_item_features:hover
{
    opacity: 1;
    visibility: visible;
    background: #EBEBEB;
    box-shadow: 0 3px 9px -2px rgba(0, 0, 0, .5);
}

.flags_item_features:before
{
  content: "";
  display: block;
  position: absolute;
  left: -10px;
  top: -10px;
  right: -10px;
  bottom: -10px;
}
<div class="buy-button-wrapper">
  <button type="button" class="btn-buy btn_buy_features custom_btn active" style="margin: 0 auto;">BUY</button>
  <div class="flags_item flags_item_features flags_home_middle">
    <div class="border_link">
      <span class="country_name"> <a href="http://shop-us.foobot.io/cart/add?id=8739494597" class="flag_lins"><img src="/wp-content/uploads/2017/01/1_2_2.png">US</a></span>
    </div>
    <div class="border_link">
      <span class="country_name"> <a href="http://shop-eu.foobot.io/cart/add?id=8346318915" class="flag_lins"><img src="/wp-content/uploads/2017/01/1_2_3.png">EU</a></span>
    </div>
    <div class="border_link">
      <span class="country_name"> <a href="http://shop-eu.foobot.io/cart/add?id=8819215683" class="flag_lins"><img src="/wp-content/uploads/2017/01/1_2_1.png">UK</a></span>
    </div>
  </div>
</div>

Answer №2

I am not sure if this is the right approach, but I found that by removing the "will-change:transform" property, the default behavior of the dropdown-menu in Bootstrap started working correctly for me.

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

"Line Divider Makeover: A Guide to Realignment and Focus

Looking to center a line divider on my webpage, I came across a method using this link: http://jsfiddle.net/gtKBs/1133/ However, I couldn't figure out how to change the straight line into a dotted one through coding. That's why I'm seeking ...

Creating a centered vertical border in Tailwind between two divs can be achieved by following these steps

Hey there, I'm working on creating a timeline and I'd like to have a line intersecting each year similar to this example. My tech stack includes tailwind CSS and next.js. Although I've written some code, I can't seem to get the line ce ...

The customized cursor image fails to load after switching the application URL from http to https

After implementing a redirect from http to https in my application, I encountered an issue with custom cursor images not displaying as intended. Prior to the redirect, the custom cursor images worked fine and were visible on the page. The URL for these cur ...

Error in Express application due to uncaught SyntaxError

I am attempting to live stream data using websockets to Chartjs, however I keep encountering the following error. main.js:1 Uncaught SyntaxError: Unexpected token <https://i.sstatic.net/9OCI1.png https://i.sstatic.net/bmGeW.gif What could be causi ...

unable to display images from a folder using v-for in Vue.js

Just getting started with Vuejs and I have two pictures stored on my website. The v-for loop is correctly populating the information inside databaseListItem. The path is /opt/lampp/htdocs/products_db/stored_images/cms.png https://i.stack.imgur.com/969U7.p ...

Troubleshooting problem with infinite scrolling in AngularJS with Ionic framework

I recently created a webpage with an infinite scroll page load more script using Ionic AngularJS. However, I encountered an issue where the page restarts from the beginning once it reaches the bottom. Below is the HTML code snippet: <ion-content class ...

What is the best way to include JavaScript CDN scripts in a component rather than in the index.html file?

There are three scripts located in the index.html file within the public folder: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jq ...

Struggling to align materialUI input or textfield horizontally

import {Input} from 'material-ui'; import Select from 'react-select'; I've been trying different ways to adjust the margins and padding, even wrapping them in divs, but I can't seem to get Material UI textfield or input alig ...

Expand JsTree Options: View Additional Choices

Can a "show more" option/link be implemented in jsTree? I am looking to display only a portion of the child elements with an option to expand and show all. Despite searching online, I have not been able to find a solution. Any assistance or suggestions wou ...

Spin the div in the opposite direction after being clicked for the second time

After successfully using CSS and Javascript to rotate a div by 45 degrees upon clicking, I encountered an issue when trying to rotate it back to 0 degrees with a second click. Despite my searches for a solution, the div remains unresponsive. Any suggestion ...

CSS - Update BackgroundColor Depending on Child Element Color

Is there an official CSS way to change the background color based on the child element in HEX? For example: render() { return ( ... <span> <h3 style={{ color: item.color }}>Item Color</h3> </span> ...

Issue with Selectric plugin not working properly after being dynamically added via jQuery

After clicking a button, I tried to clone form elements and append them to the target using this code. $('#addChild').on('click', function () { var num = $('.clonedInput').length, newNu ...

The functionality of @Output and custom events appears to be malfunctioning

I am a beginner in Angular and attempting to pass data between child and parent components. In the child component.ts file: @Output() doubleClick = new EventEmitter<string>(); onDoubleClick(nameAccount: string){ this.doubleClick.emit(nameAccoun ...

Remove any div elements that do not contain any content

I have a method on my front end that receives HTML as a string from the backend Here is the code snippet: private async tryGetOooMessage(employeeId: string): Promise<string> { try { return await firstValueFrom(this.messages.getOutOfOfficeI ...

Hide the unattractive focus border in Bootstrap-Select

I've been trying to remove a black border surrounding my selectpicker list box: https://i.sstatic.net/V2rNq.png Even without focus, the border persists: https://i.sstatic.net/ncoDM.png Despite using outline: none; in my CSS, the unwanted border re ...

PHP query for beginners. Integrating JavaScript into a PHP webpage

Hey there! I am not familiar with PHP development, as I have never worked with it before. However, I have been tasked with adding a Google Shopping cart tracking code to a website. After someone completes an order, they are sent to finishorder.php. Upon re ...

Fan Animation in CSS

I have three unique images that I would like to animate in a fan-like manner consecutively. I prefer not to merge the images in Photoshop, as I want them to be displayed one after the other. Here is the code snippet (dummy images are used): .bannerimg ...

How to implement a feature for uploading multiple files through a single form with unique input fields in a web

After searching on Stack Overflow, I couldn't find a suitable solution for my problem. I need help with my code that fetches data and sends it to a PHP file to upload files to specific folders and store their links in a database. However, I am encount ...

Enhancing the appearance of an Angular.js application

On the same page, there are two buttons - one for buying and one for selling. It appears that both buttons share the same HTML instance. This creates a problem when trying to style them individually using classes, ids, or other HTML-targeted selectors, as ...

Explore the world of threejs with a sphere adorned with cube bumps

Currently, I am navigating through the internet in search of a solution for my problem. The example I came across is quite impressive, take a look: . My dilemma lies in converting these squares into CSS cubes while ensuring that they do not get cut off by ...