Custom Query (7259 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (43 - 45 of 7259)

Ticket Resolution Summary Owner Reporter
#15194 notabug jQueryUI modal dialog doesn't block RETURN or ESCAPE keyup event Kevin Broadey
Description

I'm using a jQueryUI modal dialog widget to simulate an "alert" box. It all works as expected, with keyboard input being blocked while the dialog is open, except that if I close the dialog with the RETURN or ESCAPE key then I get a stray "keyup" event hitting my application. Why is this happening, when a modal dialog is supposed to block all input?

Here's a JSfiddle demonstrating the problem - https://jsfiddle.net/kmbro/x7w6hLtg/

While dialog() appears to be the culprit for allowing the ESCAPE "keyup" event to leak, I don't think it's directly responsible for RETURN. This seems to centre on how button "click" events are generated by the RETURN key because they fire on "keydown", so the dialog has closed before the "keyup" event occurs. In contrast, using the spacebar to press the button triggers the "click" on "keyup" so teh dialog consumes thsi event. You can see this by pressing the Click Me! button by tabbing onto it and pressing RETURN - the dialog opens on "keydown". If you press the button using SPACE instead then the dialog doesn't open until the "keyup" when you release the key.

The question is, what's so special about RETURN that is triggers a "click" event on "keydown" and not "keyup"?

#15192 notabug Clean code David Gofman
Description

I am wondering why you are excluding === and !== validation from jshint.

When I am evaluating code by using jshint I am getting many warning:

Expected !== and instead saw !=.

One of critical issue in your core widget on line 35

https://github.com/jquery/jquery-ui/blob/master/ui/widget.js#L35

You are implemented for loop such as:

for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {

however ( elem = elems[ i ] ) will never will be null i most cases is "undefined"

If I will change to strong type such as:

for ( i = 0; ( elem = elems[ i ] ) !== null; i++ ) {

I will be in infinite loop and browser will be freezes.

I will suggest make changes and fix this loops as well either:

for ( i = 0; ( elem = elems[ i ] ) !== undefined; i++ ) 

or

for ( i = 0; !!( elem = elems[ i ] ); i++ )

to handle null and undefined

Thanks, David

#15190 notabug Unable to enforce a date range for two mutually connected date pickers Manish
Description

I am trying to use jQuery UI DatePicker to allow users to choose a date period where the difference between the start and end dates is no more than 12 calendar months. The users can choose to start by selecting either the start date or the end date. They should then be restricted to select the other date only within a 12 month period between the already selected date.

A working example is available at https://jsfiddle.net/dknbwtnv/. Selecting any one date works fine but it immediately clears the other date. Therefore, the users can never select both dates successfully.

I have traced the problem to the _optionDatepicker method of the DatePicker widget (https://github.com/jquery/jquery-ui/blob/master/ui/widgets/datepicker.js). Towards the end, this method calls this._setDate, this._updateAlternate and this._updateDatepicker. For some reason, the date value being passed to _setDate is null and hence that method ends up clearing the target element. A simple check such as:

if (date) this._setDate(inst, date);

gets rid of the problem and the users are able to select both dates correctly.

Note: See TracQuery for help on using queries.