Re: [csswg-drafts] [cssom-view] Proposal: add Element.isVisible[toDocument] to detect if element is visible in the document. (#6850)

Here's some accessibility prior art, via @aleventhal.

Chromium [already implements an IsVisible](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/accessibility/ax_object.cc;l=2688?q=ax_object.cc&ss=chromium) value on accessibility objects internally, and exposes it to AT tools directly.

The implementation is equivalent to the pseudocode below. The difference between this and my proposal above is that it checks for aria-hidden and inert.

```
isVisible() { 
  return !isHiddenViaStyle() && !IsAriaHidden() && !IsInert();
}

isHiddenViaStyle() { 
  return isDisplayNone() || isVisibilityHidden() || isContentVisibilityHidden() // *not* content-visibility: auto
}

isVisibilityHidden() {
 return computedStyleOfElementIsVisibiltyHidden()
}

isAriaHidden() {
  return selfOrAncestorHasAriaHidden()
}

isInert() {
  return selfOrAncestorIsInert()
}
```

-- 
GitHub Notification of comment by chrishtr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6850#issuecomment-1022419836 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 January 2022 17:22:55 UTC