From 97f3fdf4bf5b07c860ad37db45fd5f87ada7ac0e Mon Sep 17 00:00:00 2001 From: Diane Ko Date: Thu, 29 Aug 2019 15:15:16 -0700 Subject: [PATCH] Fix issue where spin button date and year are not initializing properly The date picker spin button example would show NaN on all the dates if you tried to loop around to the first date. Also, despite there being a min and max year set, the year could be cycled through potentially infinitely beyond the min or max year. This was due to the way the min and max values were being queried. The values are set on the DOM nodes for the node with the `spinbutton` role. However, the node that was being queried for those values was the parent node. This change fixes the node used so that the initial values are set appropriately, and the spinners work as expected. --- examples/spinbutton/js/spinbutton-date.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/spinbutton/js/spinbutton-date.js b/examples/spinbutton/js/spinbutton-date.js index 59a285142c..09adbb7680 100644 --- a/examples/spinbutton/js/spinbutton-date.js +++ b/examples/spinbutton/js/spinbutton-date.js @@ -35,10 +35,10 @@ var SpinButtonDate = function (domNode, values, callback) { } } else { - this.valueMin = parseInt(domNode.getAttribute('aria-valuemin')); - this.valueMax = parseInt(domNode.getAttribute('aria-valuemax')); - this.valueNow = parseInt(domNode.getAttribute('aria-valuenow')); - this.valueText = domNode.getAttribute('aria-valuenow'); + this.valueMin = parseInt(this.spinbuttonNode.getAttribute('aria-valuemin')); + this.valueMax = parseInt(this.spinbuttonNode.getAttribute('aria-valuemax')); + this.valueNow = parseInt(this.spinbuttonNode.getAttribute('aria-valuenow')); + this.valueText = this.spinbuttonNode.getAttribute('aria-valuenow'); } this.keyCode = Object.freeze({