123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- goog.provide('goog.ui.ModalAriaVisibilityHelper');
- goog.require('goog.a11y.aria');
- goog.require('goog.a11y.aria.State');
- goog.ui.ModalAriaVisibilityHelper = function(element, domHelper) {
-
- this.element_ = element;
-
- this.dom_ = domHelper;
- };
- goog.ui.ModalAriaVisibilityHelper.prototype.hiddenElements_;
- goog.ui.ModalAriaVisibilityHelper.prototype.setBackgroundVisibility = function(
- hide) {
- if (hide) {
- if (!this.hiddenElements_) {
- this.hiddenElements_ = [];
- }
- var topLevelChildren = this.dom_.getChildren(this.dom_.getDocument().body);
- for (var i = 0; i < topLevelChildren.length; i++) {
- var child = topLevelChildren[i];
- if (child != this.element_ &&
- !goog.a11y.aria.getState(child, goog.a11y.aria.State.HIDDEN)) {
- goog.a11y.aria.setState(child, goog.a11y.aria.State.HIDDEN, true);
- this.hiddenElements_.push(child);
- }
- }
- } else if (this.hiddenElements_) {
- for (var i = 0; i < this.hiddenElements_.length; i++) {
- goog.a11y.aria.removeState(
- this.hiddenElements_[i], goog.a11y.aria.State.HIDDEN);
- }
- this.hiddenElements_ = null;
- }
- };
|