|
201 | 201 | } else if(e.keyCode === 37) {
|
202 | 202 | //left arrow
|
203 | 203 | _previousStep.call(self);
|
204 |
| - } else if (e.keyCode === 39 || e.keyCode === 13) { |
205 |
| - //right arrow or enter |
| 204 | + } else if (e.keyCode === 39) { |
| 205 | + //right arrow |
206 | 206 | _nextStep.call(self);
|
| 207 | + } else if (e.keyCode === 13) { |
| 208 | + //srcElement === ie |
| 209 | + var target = e.target || e.srcElement; |
| 210 | + if (target && target.className.indexOf('introjs-prevbutton') > 0) { |
| 211 | + //user hit enter while focusing on previous button |
| 212 | + _previousStep.call(self); |
| 213 | + } else if (target && target.className.indexOf('introjs-skipbutton') > 0) { |
| 214 | + //user hit enter while focusing on skip button |
| 215 | + _exitIntro.call(self, targetElm); |
| 216 | + } else { |
| 217 | + //default behavior for responding to enter |
| 218 | + _nextStep.call(self); |
| 219 | + } |
| 220 | + |
207 | 221 | //prevent default behaviour on hitting Enter, to prevent steps being skipped in some browsers
|
208 | 222 | if(e.preventDefault) {
|
209 | 223 | e.preventDefault();
|
|
732 | 746 | //show the tooltip
|
733 | 747 | oldtooltipContainer.style.opacity = 1;
|
734 | 748 | if (oldHelperNumberLayer) oldHelperNumberLayer.style.opacity = 1;
|
| 749 | + |
| 750 | + //reset button focus |
| 751 | + if (nextTooltipButton.tabIndex === -1) { |
| 752 | + //tabindex of -1 means we are at the end of the tour - focus on skip / done |
| 753 | + skipTooltipButton.focus(); |
| 754 | + } else { |
| 755 | + //still in the tour, focus on next |
| 756 | + nextTooltipButton.focus(); |
| 757 | + } |
735 | 758 | }, 350);
|
736 | 759 |
|
737 | 760 | } else {
|
|
869 | 892 | _disableInteraction.call(self);
|
870 | 893 | }
|
871 | 894 |
|
| 895 | + prevTooltipButton.removeAttribute('tabIndex'); |
| 896 | + nextTooltipButton.removeAttribute('tabIndex'); |
| 897 | + |
872 | 898 | if (this._currentStep == 0 && this._introItems.length > 1) {
|
873 | 899 | prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-disabled';
|
| 900 | + prevTooltipButton.tabIndex = '-1'; |
874 | 901 | nextTooltipButton.className = 'introjs-button introjs-nextbutton';
|
875 | 902 | skipTooltipButton.innerHTML = this._options.skipLabel;
|
876 | 903 | } else if (this._introItems.length - 1 == this._currentStep || this._introItems.length == 1) {
|
877 | 904 | skipTooltipButton.innerHTML = this._options.doneLabel;
|
878 | 905 | prevTooltipButton.className = 'introjs-button introjs-prevbutton';
|
879 | 906 | nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled';
|
| 907 | + nextTooltipButton.tabIndex = '-1'; |
880 | 908 | } else {
|
881 | 909 | prevTooltipButton.className = 'introjs-button introjs-prevbutton';
|
882 | 910 | nextTooltipButton.className = 'introjs-button introjs-nextbutton';
|
|
0 commit comments