Issue with Firefox browser: Arrow keys do not function properly for input tags in Twitter Bootstrap drop down menu

Requirement

I need to include a login form inside the dropdown menu with username and password fields. Everything is working fine, except for one issue:

Issue

When typing, I am unable to use the arrow keys (up/down) in Firefox. This functionality works perfectly when the input field is outside the dropdown code. However, it works flawlessly on other browsers like Google Chrome.

  • Firefox version: 26
  • Bootstrap version: 3.03
  • jQuery: 1.10

Question:

How can I resolve this problem? Could the issue be related to jQuery or Twitter's JavaScript, considering it functions properly when I move the input field outside the dropdown?

Fiddle

Here is the fiddle demonstrating the same issue: http://jsfiddle.net/santoshjoshi/WKU6M/3/

Code:

    <div id="navbar-example" class="navbar navbar-static">
    <div class="container" style="width: auto;">
        <div class="nav-collapse bs-js-navbar-collapse">
            <ul class="nav navbar-nav pull-left">
                <li id="sign-up-dropdown" class="dropdown closed noshow">
                    <a href="#" id="drop4" role="button" class="dropdown-toggle" data-toggle="dropdown">Sign Up<b class="caret">&nbsp;</b></a>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
                        <li role="presentation">
                                <div class="login_dropdown platform-font-1">
                                    <form class="form-horizontal"  action="login" method="POST">
                                        <div class="form-group">
                                            <div class="col-lg-10">
                                                <input type="text" class="form-control " id="email" name="email" placeholder="Email">&#160;</input>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                         </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</div>
<!-- Arrow keys work with the below input but not with the one inside the dropdown menu -->
<input type="text" class="form-control " id="email1" name="email" placeholder="Email">&#160;</input>

Answer №1

Seems to be a bug in the code, but you can easily fix it by preventing propagation of the onkeydown event:

Check out the demo here

$('#email').on('keydown',function(e){
    e.stopPropagation();
});

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

Tips for adjusting the alignment of numbers in an ordered list to the right

Check out the code snippet below: The list items are correctly aligned to the right, but the numbers are not. How can we adjust the CSS so that the numbers align properly on the right as well? ol { width: 15vw; } <ol style="text-align:right;"> ...

What is the best method for compressing and decompressing JSON data using PHP?

Just to clarify, I am not attempting to compress in PHP but rather on the client side, and then decompress in PHP. My goal is to compress a JSON array that includes 5 base64 images and some text before sending it to my PHP API. I have experimented with l ...

What is the best way to evenly divide divs vertically on a Bootstrap website?

I am currently working on a responsive page design and have come across this useful resource: http://www.bootply.com/2sfiCehqac My main objective is to ensure that when the screen size is medium or large: 1) div_left and div_right (orange and blue) adjus ...

Displaying incorrect text format on a TextView using Html.fromHtml()

Within my application, there is a string that represents a mathematical expression: String s = "log<small><sub>(log<small><sub>(log<small><sub>3<small><sup>2</sup></small></sub></small&g ...

Ways to eliminate brackets from a string

Currently, I am working on a challenge involving replacing strings using a function that accepts a string and an object of values. This task involves a two-part algorithm: Replacing values within the string that are enclosed in braces. If the value is wi ...

Show the results sequentially as the PHP script runs

In my current setup, I am working with Order IDs and their respective product requests. When a user selects multiple order IDs and clicks on the start process button, I compare the product requests against available stock levels. The final result displays ...

What is preventing my function from retrieving user input from an ngForm?

I'm currently working on my angular component's class. I am attempting to gather user input from a form and create an array of words from that input. The "data" parameter in my submit function is the 'value' attribute of the ngForm. Fo ...

The problem with -webkit-center in HTML

I have encountered an issue with some code that I wrote. When utilizing -webkit-center and entering text into a textbox, all the items shift to the right. I have attempted other -webkit alignment settings without any problems, only -webkit-center seems to ...

Steps to eliminate the select all checkbox from mui data grid header

Is there a way to remove the Select All checkbox that appears at the top of the checkbox data column in my table? checkboxSelection The checkboxSelection feature adds checkboxes for every row, including the Select All checkbox in the header. How can I ...

The CORS Policy error message "The 'Access-Control-Allow-Origin' header is missing on the requested resource" in Next.js

Encountered an issue with CORS Policy error while attempting to redirect to a different domain outside of the project. For example, trying to navigate to https://www.google.com through a button click or before certain pages load. The redirection was handl ...

"Changing background color, incorporating hover effects, utilizing !important, and manipulating .css properties with

Encountered a dilemma. I devised a "tabs" feature illustrated in the following demo: http://jsfiddle.net/4FLCe/ The original intention was for the tab to change color to A when hovered over, and to color B when clicked on. However, as shown in the demo, ...

Passing a JavaScript variable from the view to the controller

I have the following code in my View: jQuery.ajax({ data: "val"= + val, dataType: 'script', ype: 'post', url: "/portfolio/update" ); This is the code in my controller: j=params[:"val"] h=j.split(" ") After checking the rails conso ...

Unloading a dynamically-loaded child component in Vue.js from the keep-alive cache

I have a question that is similar to the one mentioned here: Vue.js - Destroy a cached component from keep alive I am working on creating a Tab System using Vue router, and my code looks something like this: //My Tab component <template> <tab& ...

Embracing Divs Similar to the Grid Selector in Windows Phone

Can someone help me create square divs in HTML 5, similar to the example shown? I have written this HTML5 Code - what should I include in the CSS file to achieve the desired outcome? (If Bootstrap can be used, please provide the necessary classes instead ...

The usage of nextTick in Vue.js and its role in updating components

Although I am a beginner with vue.js and have a basic understanding of it, I came across a sample code utilizing nextTick() today. Trying to comprehend its purpose led me to explore the documentation, which ended up complicating things further and leavin ...

The way images appear can vary between desktop and mobile devices

I am in the process of creating a photography website with a simple goal of displaying images down the page one after another. However, I am encountering issues with uniform display across various desktop and mobile platforms. The site appears perfect on i ...

What Methods Can I Use to Acquire the Device ID?

Is there a way to retrieve the device ID using Jquery or pure JavaScript, without relying on Cordova for my project? I have come across solutions that involve Cordova, but I prefer not to use it. Are there any alternatives available? Edit: By unique ID, ...

The noclose feature in Twitter Bootstrap is malfunctioning when placed within a div

I have a PHP page named a.php that contains the following code: <ul class="dropdown-menu noclose"> This code functions correctly, preventing the drop-down menu from closing until the user clicks outside the box. However, when I load the entire a.p ...

Is it possible to transmit image form data to a PHP function in order to facilitate uploading?

Trying to implement image upload using both jquery and PHP: Here is the HTML code snippet: <form id="form-photo" enctype="multipart/form-data">< <span class="btn btn-small fileinput-button"> <span>Add Photo</span> < ...

A problem arises when trying to showcase the content in a responsive manner on the hamburger menu, particularly when viewing on mobile

As a newcomer to web development, I decided to challenge myself by building an E-Commerce website to enhance my skills. To ensure mobile responsiveness, I opted for a hamburger menu to hide the navbar content. However, despite resizing working flawlessly, ...