|
203 | 203 | } else if(e.keyCode === 37) {
|
204 | 204 | //left arrow
|
205 | 205 | _previousStep.call(self);
|
206 |
| - } else if (e.keyCode === 39 || e.keyCode === 13) { |
207 |
| - //right arrow or enter |
| 206 | + } else if (e.keyCode === 39) { |
| 207 | + //right arrow |
208 | 208 | _nextStep.call(self);
|
| 209 | + } else if (e.keyCode === 13) { |
| 210 | + //srcElement === ie |
| 211 | + var target = e.target || e.srcElement; |
| 212 | + if (target && target.className.indexOf('introjs-prevbutton') > 0) { |
| 213 | + //user hit enter while focusing on previous button |
| 214 | + _previousStep.call(self); |
| 215 | + } else if (target && target.className.indexOf('introjs-skipbutton') > 0) { |
| 216 | + //user hit enter while focusing on skip button |
| 217 | + _exitIntro.call(self, targetElm); |
| 218 | + } else { |
| 219 | + //default behavior for responding to enter |
| 220 | + _nextStep.call(self); |
| 221 | + } |
| 222 | + |
209 | 223 | //prevent default behaviour on hitting Enter, to prevent steps being skipped in some browsers
|
210 | 224 | if(e.preventDefault) {
|
211 | 225 | e.preventDefault();
|
|
736 | 750 | //show the tooltip
|
737 | 751 | oldtooltipContainer.style.opacity = 1;
|
738 | 752 | if (oldHelperNumberLayer) oldHelperNumberLayer.style.opacity = 1;
|
| 753 | + |
| 754 | + //reset button focus |
| 755 | + if (nextTooltipButton.tabIndex === -1) { |
| 756 | + //tabindex of -1 means we are at the end of the tour - focus on skip / done |
| 757 | + skipTooltipButton.focus(); |
| 758 | + } else { |
| 759 | + //still in the tour, focus on next |
| 760 | + nextTooltipButton.focus(); |
| 761 | + } |
739 | 762 | }, 350);
|
740 | 763 |
|
741 | 764 | } else {
|
|
886 | 909 | _disableInteraction.call(self);
|
887 | 910 | }
|
888 | 911 |
|
| 912 | + prevTooltipButton.removeAttribute('tabIndex'); |
| 913 | + nextTooltipButton.removeAttribute('tabIndex'); |
| 914 | + |
889 | 915 | if (this._currentStep == 0 && this._introItems.length > 1) {
|
890 | 916 | prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-disabled';
|
| 917 | + prevTooltipButton.tabIndex = '-1'; |
891 | 918 | nextTooltipButton.className = 'introjs-button introjs-nextbutton';
|
892 | 919 | skipTooltipButton.innerHTML = this._options.skipLabel;
|
893 | 920 | } else if (this._introItems.length - 1 == this._currentStep || this._introItems.length == 1) {
|
894 | 921 | skipTooltipButton.innerHTML = this._options.doneLabel;
|
895 | 922 | prevTooltipButton.className = 'introjs-button introjs-prevbutton';
|
896 | 923 | nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled';
|
| 924 | + nextTooltipButton.tabIndex = '-1'; |
897 | 925 | } else {
|
898 | 926 | prevTooltipButton.className = 'introjs-button introjs-prevbutton';
|
899 | 927 | nextTooltipButton.className = 'introjs-button introjs-nextbutton';
|
|
0 commit comments