Skip to content

Commit

Permalink
Merge branch 'main' into brush-fixes-and-enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
dvg-p4 committed Sep 30, 2024
2 parents 5834899 + abf7138 commit 0378853
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 33 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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` 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)

* Overhauled brush code so that brush handlers (as well as click/hover handlers) persist when a plot is redrawn, and consistently move any drawn brushes to the correct location if the plot is resized. This fixes an issue where a plot that's redrawn in response to a brush would circumvent the debouncer and sometimes update twice each time the brush was moved--or worse, constantly re-update itself as the brush was being dragged. This also fixes a frustrating-to-replicate bug where the rectangle drawn on the plot could become duplicated and desynced from the coordinates sent to the server with a series of rapid user inputs. (#2344, #1642)

# shiny 1.9.1
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 @@ -8237,12 +8237,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 @@ -8686,12 +8680,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 if typing, when enter pressed or focus lost
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 if typing, when enter pressed or focus lost
callback(false);
}
);
Expand Down

0 comments on commit 0378853

Please sign in to comment.