mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
* Remove dateInput and dateRangeInput handlers for keyup and input events This prevents spurious updates while typing, but still sends when enter is pressed, focus is lost, or the GUI is clicked (due to the remaining `changeDate` and `change` handlers). * chore: small edits to comments and NEWS item --------- Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
This commit is contained in:
2
NEWS.md
2
NEWS.md
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
* Fixed a bug with `sliderInput()` when used as a range slider that made it impossible to change the slider value when both handles were at the maximum value. (#4131)
|
* Fixed a bug with `sliderInput()` when used as a range slider that made it impossible to change the slider value when both handles were at the maximum value. (#4131)
|
||||||
|
|
||||||
|
* `dateInput` and `dateRangeInput` no longer send immediate updates to the server when the user is typing a date input. Instead, it waits until the user presses Enter or clicks out of the field to send the update, avoiding spurious and incorrect date values. Note that an update is still sent immediately when the field is cleared. (#3664)
|
||||||
|
|
||||||
# shiny 1.9.1
|
# shiny 1.9.1
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|||||||
@@ -8061,12 +8061,6 @@
|
|||||||
}, {
|
}, {
|
||||||
key: "subscribe",
|
key: "subscribe",
|
||||||
value: function subscribe(el, callback) {
|
value: function subscribe(el, callback) {
|
||||||
(0, import_jquery8.default)(el).on(
|
|
||||||
"keyup.dateInputBinding input.dateInputBinding",
|
|
||||||
function() {
|
|
||||||
callback(true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
(0, import_jquery8.default)(el).on(
|
(0, import_jquery8.default)(el).on(
|
||||||
"changeDate.dateInputBinding change.dateInputBinding",
|
"changeDate.dateInputBinding change.dateInputBinding",
|
||||||
function() {
|
function() {
|
||||||
@@ -8510,12 +8504,6 @@
|
|||||||
}, {
|
}, {
|
||||||
key: "subscribe",
|
key: "subscribe",
|
||||||
value: function subscribe(el, callback) {
|
value: function subscribe(el, callback) {
|
||||||
(0, import_jquery9.default)(el).on(
|
|
||||||
"keyup.dateRangeInputBinding input.dateRangeInputBinding",
|
|
||||||
function() {
|
|
||||||
callback(true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
(0, import_jquery9.default)(el).on(
|
(0, import_jquery9.default)(el).on(
|
||||||
"changeDate.dateRangeInputBinding change.dateRangeInputBinding",
|
"changeDate.dateRangeInputBinding change.dateRangeInputBinding",
|
||||||
function() {
|
function() {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
inst/www/shared/shiny.min.js
vendored
2
inst/www/shared/shiny.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -40,19 +40,15 @@ class DateInputBindingBase extends InputBinding {
|
|||||||
el;
|
el;
|
||||||
}
|
}
|
||||||
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {
|
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {
|
||||||
$(el).on(
|
// Don't update when in the middle of typing; listening on keyup or input
|
||||||
"keyup.dateInputBinding input.dateInputBinding",
|
// tends to send spurious values to the server, based on unpredictable
|
||||||
// event: Event
|
// browser-dependant interpretation of partially-typed date strings.
|
||||||
function () {
|
|
||||||
// Use normal debouncing policy when typing
|
|
||||||
callback(true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
$(el).on(
|
$(el).on(
|
||||||
"changeDate.dateInputBinding change.dateInputBinding",
|
"changeDate.dateInputBinding change.dateInputBinding",
|
||||||
// event: Event
|
// event: Event
|
||||||
function () {
|
function () {
|
||||||
// Send immediately when clicked
|
// Send immediately when clicked
|
||||||
|
// Or if typing, when enter pressed or focus lost
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -161,19 +161,15 @@ class DateRangeInputBinding extends DateInputBindingBase {
|
|||||||
this._setMax($endinput[0], $endinput.data("max-date"));
|
this._setMax($endinput[0], $endinput.data("max-date"));
|
||||||
}
|
}
|
||||||
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {
|
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {
|
||||||
$(el).on(
|
// Don't update when in the middle of typing; listening on keyup or input
|
||||||
"keyup.dateRangeInputBinding input.dateRangeInputBinding",
|
// tends to send spurious values to the server, based on unpredictable
|
||||||
// event: Event
|
// browser-dependant interpretation of partially-typed date strings.
|
||||||
function () {
|
|
||||||
// Use normal debouncing policy when typing
|
|
||||||
callback(true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
$(el).on(
|
$(el).on(
|
||||||
"changeDate.dateRangeInputBinding change.dateRangeInputBinding",
|
"changeDate.dateRangeInputBinding change.dateRangeInputBinding",
|
||||||
// event: Event
|
// event: Event
|
||||||
function () {
|
function () {
|
||||||
// Send immediately when clicked
|
// Send immediately when clicked
|
||||||
|
// Or if typing, when enter pressed or focus lost
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user