iPad focus-event - javascript

I try to get the following working:
I have a form containing selectboxes and inputs.
There are two buttons on top of the virtual keyboard - "next" and "previous".
Navigating through the input fields works.
When I reach a selectbox (by pressing "next"), the keyboard stays and the selectbox shows its items.
When I select an item by tapping on an item of the selectbox, the element is selected and the keyboard disappears.
That's not what I want.
I want the next input or selectbox to be focused or the keyboard to stay.
I read (and tested) that the focus event does not work.
Is it possible to get this running by a workaround?
THX!

then assign the first responder to the next ui element and the keyboard will remain visible. You should do this in the code that accepts the input from the selectbox.
I am speculating, since there is no code included in the question, but I think the suggested approach should work

Related

make undo apply to drop-down menus and check boxes?

I am using Chrome. I have a page with multiple controls. I make changes in an text input, then to a drop-down (select) control, then to a check box or radio button, and then to second text input. I then press control-z once, and it undoes the change in the second text input. I press control-z again and it undoes the change in the first text input. Is there a way in to make this built-in multiple-undo process include changes to drop-down (select) controls and check boxes / radio buttons, without having to write custom code to save values, track edits, capture control-z events, etc.? I know that code is not terribly hard, but if there's a way to make it just happen that would be nice.
I only care about Chrome, so it's okay if there's a Chrome-specific way to do this.

How to select combo value on click of enter

How to select combo value on click of enter.
I am using combobox and values are coming by using mouse click and click on enter. But When I choose second value by click on enter 1st value is disappear. I a using keyboard and value appear in search. How to resolve this.
In my fiddler please select two value by click on enter, first value is disappear by clicking the second one.
Please help me to fix this. MyFiddler.
Note : I don't want to use tagfield.
The Combobox control is deliberately built around having only one selection. It used to support multi-select, but that's been deprecated since Ext 5.1 and will presumably vanish or break in nasty ways.
The only built-in way to do what you want is with Tag Fields (which you've indicated you don't want), or the Ext.view.MultiSelector class. The latter isn't a single field, but a variant of a grid.

jQuery Select2 plugin dropdown not responding to mouse clicks

I'n using the select2 jQuery plugin with an ajax call to retrieve items for the dropdown list as the user types. Multiple selections (tags) are allowed and custom selections are allowed. When the dropdown list appears, if I use the cursor keys to go to the item I want and hit enter or tab, then the everything works fine. The select2-selecting callback is triggered and the input gets updated with the selection text.
If I click on an option with the mouse, however, the select2-selecting callback is not triggered and the input is not updated. The only thing that happens is that the dropdown menu disappears, nothing else.
I have another select2 input on the same page that allows only one selection and no custom selections. Clicking dropdown items in that works fine. Example on the plugin site similar to what I'm doing respond to clicks too, so it's not a general bug with the plugin.
I am aware that select2 actually has a hidden, completely translucent container div the size of the screen that is added to the DOM whenever a select2 input has focus. The select2 input sits on top of this 'underlay' and everything else is underneath it. When the select2 input looses focus, the 'underlay' disappears. I thought that the problem might be that the underlay had a higher z-index than the input, so when I click a dropdown item I'm actually just clicking the underlay and causing the input to loose focus. Well, the input (9999) does have a higher z-index than the underlay (9998). I just wanted to rule that out.
This bit of javascript was the culprit:
input.on("select2-blur", function() {
$(this).select2('close');
});
I think that at one stage the dropdown menu was only disappearing if I tabbed out of the input, but if I clicked outside of the input when the dropdown was visible, it stayed there. I had this is as a means to get rid of the dropdown when the input lost focus. It was the cause of the problem though. Strangely, even though I've removed it now, the dropdown disappears appropriately when I click outside the input, but I don't know why that is.

Losing selection when clicking checkbox label

I am trying to get a checkbox with a label to function so that when you have text selected in a contenteditable div, clicking on the label will not lose the selection from the div. The label still needs to apply the standard checkbox tick/untick upon clicking it, but keep the focus & selection intack on the div.
Doing a simple focus() on the div won't help as the selection will be gone (and caret is at the beginning). I could of course look into a way for storing the selection object and trying to assign it back after the label click, but isn't there any simpler way of keeping the selection?
(the reason I need to do this with label & checkbox is because I will be using jQuery UI buttons and I will need the the toggle functionality of them)
On a similar note, if you click the checkbox, you usually still keep the selection in the div, but at least on FF4, if you press the checkbox very frequently (<1s), it will lose the selection. Any idea what's going on there? answered below
example: http://jsfiddle.net/niklasvh/gULM9/
It's a Firefox bug marked 490367.
According to the bug description, double-click functionality on input fields will act unusually when there is a contenteditable div on the page.
I noticed the strange behavior while trying to replicate it manually so I guessed it was a bug. I don't know of any workarounds.

How to make input not to lose focus when clicking on scrollbar in suggestion list

I'm testing TagDragon jQuery plugin, it's exactly what I need, but is has one annoying "feature", when I click the scrollbar in the suggestion list, it hides it's results. On the other hand jQuery autocomplete plugin doesn't lose the focus on the input field and that's why it doesn't hide its results. But that plugin doesn't provide the functionality I need, so I can't just replace tagdragon.
I've studied jQuery autocomplete code and I can't understand how they keep the focus on the input field, I just can't find the code responsible for that!
So the question of the day is: How to keep the focus on the input when using the scrollbar in the result suggest list?
P.S. Also I have a question of how jQuery autocomplete plugin does it, because it looks like magic to me after studding the code for an hour.
I just asked a similar question, and nobody answered it, so I basically tweaked my own code until I figured out a working solution.
After investigating some of the other pickers out there, I realized that the trick is not to add an event that closes the list on blur, instead simulate a blur event by checking other possibilities by doing the following:
upon the opening of the list, add a click event to the document that
checks to see if the click is not on in the active input, and not on
the active list. If this is true and the click is in fact on a non-listy
part of the document, then close it.
add an event to each list item in the suggest list (when the list is
open only) that selects the value and closes the list.
add an keydown event to the input itself so if the user hits enter,
it changes the value and closes the list.

Categories