I am working on a modal commenting system using jQuery and jQuery UI, but I have some focus issues. I have a series of divs inside a modal to switch between Login and Add comment, as shown below:
<div id="modal" title="Loading"> <div id="modalContent"></div> <div id="modalLogin"> <div class="loginBox"></div> <div class="addCommentBox"></div> <div class="commentReview"></div> </div> </div>
Inside the addCommentBox div, I have a comment code:
<form action="/comments/add" class="addCommentForm" name="addCommentForm" method="post"> <textarea name="content" class="addCommentContent"></textarea> <button value="Add Comment" type="submit" class="commentPost"/> <button value="Clear Comment" type="submit" id="clearComment"/> </form>
The problem is that approximately half the time after the dialog opens, the text field inside the addCommentBox div addCommentBox not respond to keyboard input when selected. The mouse works correctly and allows you to select text, but keyboard control does nothing.
I do not have event listeners in the text box. I have buttons on buttons, but they focus only on buttons.
The only thing that happens in HTML seems to be that every time I click on a modal, the z-index is incremented for the general modal div. I set the addCommentBox div for the z-index of 9999, which is more than the z-index of the modal.
Any suggestions or research directions are welcome. Thanks!
javascript jquery jquery-ui dialog textarea
Andrew Anderson
source share