Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sporadic dates (#3664) #3665

Merged
merged 19 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

* `dateInput` and `dateRangeInput` will not send spurious values to the server while typing until the user presses enter or clicks out of the field (except for `null` or `NA` when the field is completely empty). (#3664)
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved

# shiny 1.9.1

## Bug fixes
Expand Down
12 changes: 0 additions & 12 deletions inst/www/shared/shiny.js
Original file line number Diff line number Diff line change
Expand Up @@ -8061,12 +8061,6 @@
}, {
key: "subscribe",
value: function subscribe(el, callback) {
(0, import_jquery8.default)(el).on(
"keyup.dateInputBinding input.dateInputBinding",
function() {
callback(true);
}
);
(0, import_jquery8.default)(el).on(
"changeDate.dateInputBinding change.dateInputBinding",
function() {
Expand Down Expand Up @@ -8510,12 +8504,6 @@
}, {
key: "subscribe",
value: function subscribe(el, callback) {
(0, import_jquery9.default)(el).on(
"keyup.dateRangeInputBinding input.dateRangeInputBinding",
function() {
callback(true);
}
);
(0, import_jquery9.default)(el).on(
"changeDate.dateRangeInputBinding change.dateRangeInputBinding",
function() {
Expand Down
4 changes: 2 additions & 2 deletions inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions srcts/src/bindings/input/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,15 @@ class DateInputBindingBase extends InputBinding {
el;
}
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {
$(el).on(
"keyup.dateInputBinding input.dateInputBinding",
// event: Event
function () {
// Use normal debouncing policy when typing
callback(true);
}
);
// Don't update when in the middle of typing; listening on keyup or input
// tends to send spurious values to the server, based on unpredictable
// browser-dependant interpretation of partially-typed date strings.
$(el).on(
"changeDate.dateInputBinding change.dateInputBinding",
// event: Event
function () {
// Send immediately when clicked
// Or after typing, when enter pressed or focus lost
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
callback(false);
}
);
Expand Down
12 changes: 4 additions & 8 deletions srcts/src/bindings/input/daterange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,15 @@ class DateRangeInputBinding extends DateInputBindingBase {
this._setMax($endinput[0], $endinput.data("max-date"));
}
subscribe(el: HTMLElement, callback: (x: boolean) => void): void {
$(el).on(
"keyup.dateRangeInputBinding input.dateRangeInputBinding",
// event: Event
function () {
// Use normal debouncing policy when typing
callback(true);
}
);
// Don't update when in the middle of typing; listening on keyup or input
// tends to send spurious values to the server, based on unpredictable
// browser-dependant interpretation of partially-typed date strings.
$(el).on(
"changeDate.dateRangeInputBinding change.dateRangeInputBinding",
// event: Event
function () {
// Send immediately when clicked
// Or after typing, when enter pressed or focus lost
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
callback(false);
}
);
Expand Down
Loading