HTML input fields does not get focus when clicked

后端 未结 27 2025
予麋鹿
予麋鹿 2020-12-08 06:11

I have a problem and I can\'t figure out what exactly is causing this behavior. I cannot access my input fields and textareas on my HTML form.

Unfortun

相关标签:
27条回答
  • 2020-12-08 06:48

    In my case it was Bootstrap popup in opened state. Text input was in another calendar popup on top of Bootstrap one, input got its focus back after removing tabindex="-1" attribute from Bootstrap modal.

    0 讨论(0)
  • 2020-12-08 06:52

    I had this problem for over 6 months, it may be the same issue. Main symptom is that you can't move the cursor or select text in text inputs, only the arrow keys allow you to move around in the input field. Very annoying problem, especially for textarea input fields. I have this html that gets populated with 1 out of 100s of forms via Javascript:

    <div class="dialog" id="alert" draggable="true">
        <div id="head" class="dialog_head">
            <img id='icon' src='images/icon.png' height=20 width=20><img id='icon_name' src='images/icon_name.png' height=15><img id='alert_close_button' class='close_button' src='images/close.png'>
        </div>
        <div id="type" class="type"></div>
        <div class='scroll_div'>
            <div id="spinner" class="spinner"></div>
            <div id="msg" class="msg"></div>
            <div id="form" class="form"></div>
        </div>
    </div>
    

    Apparently 6 months ago I had tried to make the popup draggable and failed, breaking text inputs at the same time. Once I removed draggable="true" it works again!

    0 讨论(0)
  • 2020-12-08 06:52

    This will also happen anytime a div ends up positioned over controls in another div; like using bootstrap for layout, and having a "col-lg-4" followed by a "col-lg=8" misspelling... the right orphaned/misnamed div covers the left, and captures the mouse events. Easy to blow by that misspelling, - and = next to each other on keyboard. So, pays to examine with inspector and look for 'surprises' to uncover these wild divs.

    Is there an unseen window covering the controls and blocking events, and how can that happen? Turns out, fatfingering = for - with bootstrap classnames is one way...

    0 讨论(0)
提交回复
热议问题