var animationTarget = $('body, html').stop(true, true);
if (this.isStepActuallyVisible(stepConfig)) {
- var zIndex = this.calculateZIndex(this.getStepTarget(stepConfig));
+ var targetNode = this.getStepTarget(stepConfig);
+
+ targetNode.data('flexitour', 'target');
+
+ var zIndex = this.calculateZIndex(targetNode);
if (zIndex) {
stepConfig.zIndex = zIndex + 1;
}
this.currentStepNode.offset(this.calculateStepPositionInPage());
this.currentStepPopper = new Popper($('body'), this.currentStepNode[0], {
+ removeOnDestroy: true,
placement: stepConfig.placement + '-start',
arrowElement: '[data-role="arrow"]',
// Empty the modifiers. We've already placed the step and don't want it moved.
target.data('original-describedby', target.attr('aria-describedby')).attr('aria-describedby', stepId + '-body');
}
+ this.accessibilityShow(stepConfig);
+
return this;
};
// Reset the listeners.
this.resetStepListeners();
+ this.accessibilityHide();
+
this.fireEventHandlers('afterHide');
this.currentStepNode = null;
return data;
};
+Tour.prototype.accessibilityShow = function (stepConfig) {
+ var stateHolder = 'data-has-hidden';
+ var attrName = 'aria-hidden';
+ var hideFunction = function hideFunction(child) {
+ var flexitourRole = child.data('flexitour');
+ if (flexitourRole) {
+ switch (flexitourRole) {
+ case 'container':
+ case 'target':
+ return;
+ }
+ }
+
+ var hidden = child.attr(attrName);
+ if (!hidden) {
+ child.attr(stateHolder, true);
+ child.attr(attrName, true);
+ }
+ };
+
+ this.currentStepNode.siblings().each(function (index, node) {
+ hideFunction($(node));
+ });
+ this.currentStepNode.parentsUntil('body').siblings().each(function (index, node) {
+ hideFunction($(node));
+ });
+};
+
+Tour.prototype.accessibilityHide = function () {
+ var stateHolder = 'data-has-hidden';
+ var attrName = 'aria-hidden';
+ var showFunction = function showFunction(child) {
+ var hidden = child.attr(stateHolder);
+ if (typeof hidden !== 'undefined') {
+ child.removeAttr(stateHolder);
+ child.removeAttr(attrName);
+ }
+ };
+
+ $('[' + stateHolder + ']').each(function (index, node) {
+ showFunction($(node));
+ });
+};
+
if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
module.exports = Tour;
}